web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

posted sales invoice Send by Email action

(0) ShareShare
ReportReport
Posted on by 50

Hi All,

       

         Can we able to change the invoice No. in the Subject field of the action Send by Email in posted sales invoice, here for me the invoice No. is coming correctly, but i don't want the starting numbers Upto  "100-" how can we achieve this through al code, is there any possible way to achieve this through code or we have to manually change the number only, I am attaching a screenshot of it. advance thanks for your advices.

pastedimage1686570577815v2.png

Thanks & Regards

Satish.

      

  • Verified answer
    Mohana Yadav Profile Picture
    61,248 Super User 2026 Season 2 on at

    You can use OnBeforeGetEmailSubject and return the subject as you want.

  • Suggested answer
    Nitin Verma Profile Picture
    21,812 Moderator on at

    Hi,

    Yes you can try below code, this is for example, you can replace your values by External document no. in the below function.

     local procedure OnBeforeGetEmailSubject(PostedDocNo: Code[20]; EmailDocumentName: Text[250]; ReportUsage: Integer; var EmailSubject: Text[250]; var IsHandled: Boolean)
        var
            SalesInvoiceHeader: Record "Sales Invoice Header";
            CompanyInformation: Record "Company Information";
            EmailSubjectCapTxt: Label '%1 - %2 %3, %4', Comment = '%1 = Customer Name. %2 = Document Type %3 = Invoice No.';
        begin
            if SalesInvoiceHeader.get(PostedDocNo) then begin
                CompanyInformation.get;
                EmailSubject := StrSubstNo(EmailSubjectCapTxt, CompanyInformation.Name, 'Sales Invoice', SalesInvoiceHeader."No.", SalesInvoiceHeader."External Document No.");
                IsHandled := true;
            end;
        end;

  • Verified answer
    YUN ZHU Profile Picture
    103,294 Super User 2026 Season 2 on at

    Hi, hope the following helps.

    How to change default subject of the email when sending mail in Dynamics 365 Business Central – Customization

    https://yzhums.com/34909/

    Thanks.

    ZHU

  • Suggested answer
    rostad.exe Profile Picture
    60 on at

    You could automate these parts of business central with power automate and with much more freedom to customize stuff like the subject.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 796 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 481 Super User 2026 Season 2

#3
AndrewThomas81 Profile Picture

AndrewThomas81 377 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans