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

How yo print notes on email body

(0) ShareShare
ReportReport
Posted on by 200

Here I have email body where I need note printed,

procedure SendEmail(oldno: Record Enquiries; newno: Code[20])

    var

        cdu_EmailMessage: Codeunit "Email Message";

        cdu_Email: Codeunit Email;

        ToRecipients: Text;

        Subject: Text;

        Body, AddBody : Text;

        textWorkDes: Text[100];

        enum_RecipientType: Enum "Email Recipient Type";

        rec_enquries: Record Enquiries;

        rec_salesheader: Record "Sales Header";

        enum_DocumentType: Enum "Sales Document Type";

        enum_Alerts: Enum Alerts;

        SalesPostedMsg: Label '<br> The initial SalesOrder Number is <strong>%1</strong>. <br>The Replacement SalesOrder Number is <strong>%2</strong>. <br> The Note is <strong>%3</strong>';

    begin

        Subject := 'Enquries';

        Body := StrSubstNo(SalesPostedMsg, oldno.No, newno, oldno.Note);

        Body += '<br><br>Kind Regards,<br><br>Business Central';

       cdu_EmailMessage.Create(cdu_CommonHelper.EmailSetup(enum_Alerts::"EnquiriesAndReturns"), Subject, Body, true);

        if rec_enquries.Count > 0 then begin

            cdu_Email.Send(cdu_EmailMessage);

            //rec_enquries.DeleteAll(); end;

        end;

    end;

With this code my notes entered in input box is coming now,

The-notes-module.png

But I want,

2845.Screenshot_5F00_1.png

I want this note Test1 which I got using copylinks function to be printed in my mail how can do that please help

I have the same question (0)
  • Suggested answer
    Tech-Lucky Profile Picture
    1,261 Super User 2025 Season 2 on at
    RE: How yo print notes on email body

    Create the below function and call the function in your code remember to fetch the SalesHeader Record variable to pass it as a parameter and store the return value of the function to a Variable and place that variable in your Email Body as per your requirement.

        Procedure GetNotes(Var SalesHeader: Record "Sales Header") AllNotes: Text
        Var
            RecordLink: Record "Record Link";
            RecordLinkMangt: Codeunit "Record Link Management";
        Begin
            RecordLink.Reset();
            RecordLink.Setrange("Record ID", SalesHeader.RecordID);
            RecordLink.Setrange(Type, RecordLink.Type::Note);
            IF RecordLink.Findset Then
                Repeat
                    RecordLink.Calcfields(Note);
                    IF AllNotes = '' then
                        AllNotes := RecordLinkMangt.ReadNote(RecordLink)
                    else
                        AllNotes := AllNotes   ', '   RecordLinkMangt.ReadNote(RecordLink);
                Until RecordLink.Next() = 0;
    
        end;

    mark my answer varified if this helps you.

  • Dividutt Profile Picture
    200 on at
    RE: How yo print notes on email body

    Hi, Thanks for this, but I have a question that Notes data type is blob so whether I need to convert it? Because still I was getting note blank in my email body

  • Suggested answer
    Tech-Lucky Profile Picture
    1,261 Super User 2025 Season 2 on at
    RE: How yo print notes on email body

    sorry please add RecordLink.Calcfields(Note); after repeat: i have modified the Previous code you can check.

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…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

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

#1
Sumit Singh Profile Picture

Sumit Singh 2,163

#2
OussamaSabbouh Profile Picture

OussamaSabbouh 1,908

#3
YUN ZHU Profile Picture

YUN ZHU 1,878 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans