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...
Unanswered

How to copy Links section in business central?

(0) ShareShare
ReportReport
Posted on by 208

When I copy links from sales order to enquiry card link section is coming blank?

I used this code:

procedure CopyLinksFromEnquiriesToSalesL(rec_Enquiries: Record Enquiries)
    var
        SourceRecordLink: Record "Record Link";
        rec_SalesHeader: Record "Sales Header";
        textWorkDes: Text[500];
        rec_notes: record Notes_temp;
        RecordLink: Record "Record Link";
        LinkManagement: Codeunit "Record Link Management";
        LastEntryNo: Integer;
    begin

        rec_notes.DeleteAll();
        if RecordLink.FindLast() then
            LastEntryNo := RecordLink."Link ID"
        else
            LastEntryNo := 0;

        SourceRecordLink.SetRange("Record ID", rec_Enquiries.RecordId);
        if SourceRecordLink.FindSet() then
            repeat
                textWorkDes := GetWorkDescription(SourceRecordLink);
                textWorkDes := DELSTR(textWorkDes, 1, 1);
                rec_notes.Init();
                rec_notes.No := CreateGuid();
                rec_notes.Notes := textWorkDes;
                rec_notes.Links := textWorkDes;
                rec_notes."Record Id" := SourceRecordLink."Link ID";
                rec_notes.Insert();
            until SourceRecordLink.Next() = 0;

        rec_SalesHeader.SetRange("No.", rec_Enquiries.No);
        if rec_SalesHeader.FindSet() then begin
            SourceRecordLink.SetRange("Record ID", rec_SalesHeader.RecordId);
            if SourceRecordLink.FindSet() then
                repeat
                    textWorkDes := GetWorkDescription(SourceRecordLink);
                    textWorkDes := DELSTR(textWorkDes, 1, 1);

                    rec_notes.SetRange(Links, textWorkDes);
                    if not rec_notes.FindSet() then begin
                        LastEntryNo := LastEntryNo + 1;
                        // rec_Enquiries.DeleteLinks();
                        RecordLink.Init();
                        RecordLink.Company := CompanyName();
                        RecordLink.Type := RecordLink.Type::Link;
                        RecordLink.Created := CurrentDateTime;
                        RecordLink."User ID" := UserId();
                        RecordLink."Link ID" := LastEntryNo;
                        RecordLink."Record ID" := rec_Enquiries.RecordId;
                        LinkManagement.WriteNote(RecordLink, textWorkDes);
                        RecordLink.Insert(true);
                    end;
                until SourceRecordLink.Next() = 0;
        end;
    end;

    procedure GetWorkDescription(SourceRecordLink: Record "Record Link") link: Text

    var
        MyInStream: InStream;

    begin
        Clear(link);
        SourceRecordLink.Calcfields(Note);
        If SourceRecordLink.Note.HasValue() then begin
            SourceRecordLink.Note.CreateInStream(MyInStream);
            MyInStream.Read(link);

        end;

    end
I changed type to link, still getting blank.
 Any additional changes is required in my code so that my link section also get copied?
Please help thankyou.

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

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 748 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 354 Super User 2026 Season 2

#3
AndrewThomas81 Profile Picture

AndrewThomas81 351 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans