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

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

Send Email from Custom Report Selection with Email body

(1) ShareShare
ReportReport
Posted on by 10
Hi,
Problem to solve: /Get the email body as text from Report Selection- Email Body Custom Layout Description/

Process: 
I extended the /Report Selection - Sales/ by adding my own option to the enum. Called /GiftCard/

I was able to add a report ID and add an Email Body Custom Layout Description with no problem. We will be using this new option in multiple companies and each company have their own email body.

When sending an email we use /EmailMessage: Codeunit /Email Message/;/ and EmailMessage.Create()
This is the most basic structure of email we can use. 

We want to retrieve the Word layout from Report Selection and convert it to HTML and use that as the body. 

The First option we looked at was in Report Selection (Table: 77)- Procedure GetEmailBodyTextForCust()
Which (In Short) is OnPrem and save the file path on the server and makes use of another onPrem function
 REPORT.SaveAsHtml(ReportID, FilePath, RecordVariant);- Report.SaveAsHtml() is a built in function that we can't copy over
 
The second option we looked at was the Sales Order- Send Email, which led us to codeunit 8906 Email Editor, 
Here we have the WordTemplateToTextWizard that GetsDocumentAsText(), but this procedure us also a bit confusing. We cant seem to find where the Word document is retrieved from the Report Selection. We can se that it is used in the SetBody() procedure.

This is for a SAAS client, I would like to avoid onPrem procedures or copying procedures from Base to implement. 
So how does Microsoft do it in SAAS? or do they still use the OnPrem Procedures?

Thanks in advance

 
 
I have the same question (0)
  • Suggested answer
    YUN ZHU Profile Picture
    95,681 Super User 2025 Season 2 on at
    Hi, I feel like they are still using OnPrem Procedures.
    For example,
    Sorry I haven't tested it in detail, you can try the following methods or events.
    table 9500 "Email Item" -> procedure GetBodyTextFromBlob() Value: Text
     
    Hope this helps.
    Thanks.
    ZHU
     

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,606

#2
YUN ZHU Profile Picture

YUN ZHU 931 Super User 2025 Season 2

#3
Jainam M. Kothari Profile Picture

Jainam M. Kothari 773 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans