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

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
    152 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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,926 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,158 Super User 2026 Season 1

#3
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 533 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans