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

AL script add sales order Note

(0) ShareShare
ReportReport
Posted on by

Hello

We are trying to add sales order note using AL script.
Can anyone help us and tell how we can do it?

In MBC i see that this part of page linked to RecordLink table, but how we can add actual Note text and link it to specific sales order?

Thanks in advance!

I have the same question (0)
  • Suggested answer
    JAngle Profile Picture
    133 on at

    Used this recently to migrate notes which were added to a custom table first. Similar pattern would work for your scenario:

    codeunit 90000 "Create Notes"

    {

       trigger OnRun()

       var

           NotesImport: Record "Notes Import";

           Contact: Record Contact;

       begin

           GetLastEntryNo();

           if NotesImport.FindSet() then

               repeat

               if Contact.Get(NotesImport."Contact No.") then begin

                   CreateSystemLink(Contact.RecordId, NotesImport.Note);

                   NotesImport.Delete();

               end;

           until NotesImport.Next() = 0;

       end;

       procedure CreateSystemLink(IncomingRecordID: RecordId; NoteText: Text)

       var

           RecordLink: Record "Record Link";

           LinkManagement: Codeunit "Record Link Management";

       begin

           LastEntryNo += 1;

           RecordLink.Init();

           RecordLink.Company := CompanyName();

           RecordLink.Type := RecordLink.Type::Note;

           RecordLink.Created := CurrentDateTime;

           RecordLink."User ID" := UserId();

           RecordLink."Link ID" := LastEntryNo;

           RecordLink."Record ID" := IncomingRecordID;

           LinkManagement.WriteNote(RecordLink, NoteText);

           RecordLink.Insert(true);

       end;

       procedure GetLastEntryNo()

       var

           RecordLink: Record "Record Link";

       begin

           if RecordLink.FindLast() then

               LastEntryNo := RecordLink."Link ID"

           else

               LastEntryNo := 0;

       end;

       var

           LastEntryNo: Integer;

    }

  • Suggested answer
    Community Member Profile Picture
    on at

    Josh, thanks so much

    Will try to adopt your script to our scenario, this helps a lot!

  • Dividutt Profile Picture
    200 on at

    How can we delete notes vise versa?

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,664

#2
YUN ZHU Profile Picture

YUN ZHU 960 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