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...
Suggested Answer

Attach Sale invoice with Reminder

(0) ShareShare
ReportReport
Posted on by 55

Hi,

I want to send the Sale invoice as an attachment when I send a reminder by email to the customer. So how can I do that?

I have the same question (0)
  • Suggested answer
    Manan_Shah Profile Picture
    1,461 on at

    Hi Ghulam,

    To achieve this. Please ask your development partner to develop this custom functionality


    Hope this will help. 

    Many Thanks,
    Manan

  • Ghulam_Mustafa Profile Picture
    55 on at

    Do you how can i do this because i am working on that to create custom functionality?

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

    Hi,

    Just go to the Posted sales invoice and check Send button, you can have an idea how to make a Email reminder.

    Also please consult with your development partner to achieve this.

    Thanks.

  • Suggested answer
    DAnny3211 Profile Picture
    11,419 Super User 2026 Season 1 on at

    hi

    look this

    learn.microsoft.com/.../ui-how-send-documents-email

    but I think for your purpose you need a development in AL

    DAniele

  • Suggested answer
    Amit Profile Picture
    2,563 on at

    for this, do customization at sending reminder event. Consult your Partner.

    Regards

    Amit Sharma

    www.erpconsultors.com

  • Suggested answer
    pankaj.k Profile Picture
    1,020 on at

    Hi Ghulam,

    your requirement needs to be developed but  no worries  its possible  i attached code for you this will help to develop.

    this code helps you to  attached file and  Send Email. 

    attechment.PNG

        procedure SendPaperStatementMail(Var Rec_AccountNumber: Text)
        var
            email: Codeunit Email;
            emailMsg: Codeunit "Email Message";
            tempblobcu: Codeunit "Temp Blob";
            cnv64: Codeunit "Base64 Convert";
            InStr: InStream;
            txtB64: Text;
            Text001: Text;
            RecRef: RecordRef;
            Outstreamreport: OutStream;
            LoanStatement: Report "Loan Statement Report";
            LoanHeader: Record Ecl_LoanHeader;
            char13: Char;
            char10: Char;
            NewLine: Text;
            cominfo: Record "Company Information";
            custrec: Record customer;
            SalesRec: Record "Sales & Receivables Setup";
        begin
            cominfo.Get();
            SalesRec.Get();
            LoanHeader.Reset();
            LoanHeader.SetRange(AccountNumber, Rec_AccountNumber);
            IF LoanHeader.FindFirst() then
                if SalesRec.PaperStatementEmail <> '' then
                    if custrec.get(LoanHeader."Customer No.") then
                        if custrec.ecl_SendPaperStatement then
                            if (LoanHeader."Statement Date" <> 0D) or (LoanHeader."Statement No" <> 0) then begin
                                RecRef.GetTable(LoanHeader);
                                tempblobcu.CreateOutStream(Outstreamreport);
                                Report.SaveAs(50191, 'Test', ReportFormat::Pdf, Outstreamreport, RecRef);
                                char13 := 13;
                                char10 := 10;
                                NewLine := char10;
                                Text001 := StrSubstNo('Dear %1,', LoanHeader.name);
                                Text001 += NewLine + NewLine;
                                Text001 += StrSubstNo('Please find attached your monthly statement for your Coogans Account %1 which has a current balance of $%2.',
                                                    LoanHeader.AccountNumber, format(ROUND(LoanHeader.LastClosingBalance, 0.01, '='), 0, '<Precision,2:2><Standard Format,0>'));
                                Text001 += NewLine + NewLine;
                                Text001 += StrSubstNo('The minimum payment required for this month is $%1 and it is due on %2.', format(ROUND(LoanHeader.Minimum_Payment, 0.01, '=') +
                                                        LoanHeader.Total_Arrears, 0, '<Precision,2:2><Standard Format,0>'), Format(LoanHeader.NextDueDate, 0, '<Day,2>/<Month,2>/<Year4>'));
                                Text001 += NewLine + NewLine;
                                Text001 += StrSubstNo('Please contact us on %1 if you have any questions or would like to speak to us about your account.', cominfo."Phone No. 2");
                                Text001 += NewLine + NewLine;
                                Text001 += NewLine + NewLine;
                                Text001 += 'Sincerely';
                                Text001 += NewLine + NewLine;
                                Text001 += 'The yyy Team' + NewLine;
                                Text001 += cominfo."Home Page" + NewLine;
                                text001 += cominfo."Phone No. 2";
                                tempblobcu.CreateInStream(InStr);
                                txtB64 := cnv64.ToBase64(InStr, true);
                                emailMsg.Create(SalesRec.PaperStatementEmail, StrSubstNo('Paper Statement for the Loan Account No. %1', LoanHeader.AccountNumber), Text001);
                                emailMsg.AddAttachment('Statement for ' + LoanHeader.name + ' as of ' + Format(LoanHeader."Statement Date", 0, '<Day,2>-<Month,2>-<Year>') + '.pdf', 'application/pdf', txtB64);
                                IF email.Send(emailMsg) then;
                            end;
        end;

    Please check More information about reminder :- https://learn.microsoft.com/en-us/dynamics365/business-central/receivables-send-reminders

    Thanks 

    Click on Yes button if my answer helped you.

  • Suggested answer
    Ghulam_Mustafa Profile Picture
    55 on at

    Thanks, everyone for the suggestions.

    Scenario: Before the development, when I try to send the reminder as an email it only adds the reminder report so I need a sales invoice as an attachment.

    I had done the task and here is the code:

    pastedimage1670582852700v1.pngpastedimage1670582910131v2.png

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,831 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,122 Super User 2026 Season 1

#3
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 690 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans