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

How yo print notes on email body

(0) ShareShare
ReportReport
Posted on by 208

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

  • Suggested answer
    Tech-Lucky Profile Picture
    1,288 Moderator on at

    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
    208 on at

    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,288 Moderator on at

    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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 624 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 440 Super User 2026 Season 2

#3
Teagen Boll Profile Picture

Teagen Boll 244 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans