pageextension 50120 CustListExtEmail extends "Customer List" { actions { addafter("&Customer") { action(EmailEdit) { Promoted = true; PromotedCategory = Process; PromotedIsBig = true; PromotedOnly = true; Image = Email; ApplicationArea = All; trigger OnAction() begin EmailEdit(Rec."No."); end; } } } local procedure EmailEdit(CustomerId: Code[20]): Text var tmpBlob: Codeunit "Temp Blob"; cnv64: Codeunit "Base64 Convert"; InStr: InStream; OutStr: OutStream; txtB64: Text; format: ReportFormat; email: Codeunit Email; emailMsg: Codeunit "Email Message"; recRef: RecordRef; Customer: Record Customer; begin Customer.Get(CustomerId); Customer.SetRange("No.", CustomerId); recRef.GetTable(Customer); tmpBlob.CreateOutStream(OutStr); if Report.SaveAs(Report::"Customer - Order Summary", '', format::Pdf, OutStr, recRef) then begin tmpBlob.CreateInStream(InStr); txtB64 := cnv64.ToBase64(InStr, true); emailMsg.Create('', '', ''); emailMsg.AddAttachment('OrderSummary.pdf', 'application/pdf', txtB64); email.OpenInEditor(emailMsg); end; end; }
Answers
You could take a look to this:
https://robertostefanettinavblog.com/2021/01/20/business-central-enhanced-emails/
Regards.
Thanks, but I need help to develop changes to my report.
Best regards,
Morten
Here is an example of how to save a report to PDF and then show the email compose page.
Regards.
Thank you very much! That is great!
Best regards,
Morten