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

Community site session details

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

Can we attach excel sheet send through mail using processing report in business central.

(0) ShareShare
ReportReport
Posted on by 153
Hi Guys,
Can we attach excel sheet send through mail using processing report in business central?
Is any way to do this.
I have the same question (0)
  • Janarthananv Profile Picture
    91 on at
    Can we attach excel sheet send through mail using processing report in business central.
    Dear  Nilam bhor,
     
    Please call the function in the button or code unit. This code is working for us. Please give a try and let us know
     
    Please use the given below
     
     local procedure Email()
        var
            Email: Codeunit Email;
            EmailMessage: Codeunit "Email Message";
            TempBlob: Codeunit "Temp Blob";
            ReportParameters: Text;
            EmailBody: Text[100];
            Subject: Text[100];
            Recipient: Text[1000];
            InStr: Instream;
            OutStr: OutStream;
            ReportValves: Text[100];
        begin
            EmailBody := 'Dear Team, ';
            EmailBody += 'Please find attached the reports as of ';
            Subject := 'Sample Subject';
            ReportValves := 'Sample Report';
            ReportValves += '.xlsx';
            Recipient := 'Test@gmail.com';
            EmailMessage.Create(Recipient, Subject, EmailBody);
            TempBlob.CreateOutStream(OutStr);
            TempBlob.CreateInStream(InStr);
            Report.SaveAs(Report::"Standard Sales - Invoice", ReportParameters, ReportFormat::Excel, OutStr);
            EmailMessage.AddAttachment(ReportValves, 'Excel', InStr);
            Email.Send(EmailMessage, Enum::"Email Scenario"::Default);
        end;
     
     
    Thanks
    Janarthanan v

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

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

#1
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 4,308

#2
Sumit Singh Profile Picture

Sumit Singh 2,798

#3
Nimsara Jayathilaka. Profile Picture

Nimsara Jayathilaka. 2,793

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans