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

How to copy Links section in business central?

(0) ShareShare
ReportReport
Posted on by 200

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.
I have the same question (0)

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 3,229

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,867 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,153 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans