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,
But I want,
I want this note Test1 which I got using copylinks function to be printed in my mail how can do that please help
sorry please add RecordLink.Calcfields(Note); after repeat: i have modified the Previous code you can check.
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
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.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,151 Super User 2024 Season 2
Martin Dráb 229,993 Most Valuable Professional
nmaenpaa 101,156