Hi,I am able to copy notes of same table, but I have two table one local table and one business Central table, so when I add note to my local table, my note is not getting updated in new sales order, so please any idea for that?
So how can notes be copied between different tables like notes on local table copy to update sales order table need Al code functionality for that:
Local table card, added notes here and went to exchange action and
After when I click on create exchange action I get the updated sales return order where I need to copy my notes,but not copied.
Here is the code that I tried, is there anything can be updated please help.
Do we need to change onopenpage trigger?
Or how it can be done?
Here it is:
if rec_SalesHeader.FindSet() then begin
repeat
recEnquiries.SetRange(No, rec_SalesHeader."No.");
if not recEnquiries.FindFirst() then begin
recEnquiries.Init();
recEnquiries.Id := CreateGuid();
recEnquiries.No := rec_SalesHeader."No.";
recEnquiries."Sell-to Customer Name" := rec_SalesHeader."Ship-to Name";
recEnquiries.Contact := rec_SalesHeader."Ship-to Contact";
recEnquiries.Address := rec_SalesHeader."Ship-to Address";
recEnquiries.County := rec_SalesHeader."Ship-to County";
recEnquiries.Postcode := rec_SalesHeader."Ship-to Post Code";
recEnquiries.Country := rec_SalesHeader."Ship-to Country/Region Code";
recEnquiries.Email := rec_SalesHeader."Sell-to E-Mail";
recEnquiries.Phone := rec_SalesHeader."Ship-to Contact";
recEnquiries."Sell-to City" := rec_SalesHeader."Ship-to City";
recEnquiries."Ship-to-Contact" := rec_SalesHeader."Ship-to Contact";
recEnquiries."Ship-to City" := rec_SalesHeader."Ship-to City";
recEnquiries."Ship-to County" := rec_SalesHeader."Ship-to County";
recEnquiries."Ship-to Post Code" := rec_SalesHeader."Ship-to Post Code";
recEnquiries."Ship-to Country" := rec_SalesHeader."Ship-to Country/Region Code";
recEnquiries."Ship-to Address" := rec_SalesHeader."Ship-to Address";
rec_SalesHeader.CalcFields("Amount Including VAT");
recEnquiries."Total Value" := rec_SalesHeader."Amount Including VAT";
recEnquiries.History := GetSalesHistory(rec_SalesHeader."No.");
recEnquiries.Reference := rec_SalesHeader."Your Reference";
recEnquiries.Description := rec_SalesHeader."External Document No.";
// recEnquiries."Internal Notes" := rec_SalesHeader.customDeliveryNotes;
recEnquiries.isArchive := false;
recEnquiries.DateCreated := DT2DATE(rec_SalesHeader.SystemCreatedAt);
recEnquiries."Sell-to Customer No." := rec_SalesHeader."Sell-to Customer No.";
recEnquiries."Location Code" := rec_SalesHeader."Location Code";
recEnquiries.Status := rec_SalesHeader.Status;
if rec_SalesHeader.HasLinks then
recEnquiries.CopyLinks(rec_SalesHeader);
recEnquiries.Insert(true);
InsertSalesLine(recEnquiries.No);
end;
until rec_SalesHeader.Next() = 0;
end;
/calling
Trigger onopenpage()
Var
Cu_entry: Codeunit Enquiry
Begin
Cu_entry.InsertEnquiriesHeader();
End;
where did you write this code?
Please share your full code.
When I am revisiting the page the notes count is increasing why?
recEnquiries."Sell-to Customer No." := rec_SalesHeader."Sell-to Customer No.";
recEnquiries."Location Code" := rec_SalesHeader."Location Code";
recEnquiries.Status := rec_SalesHeader.Status;
if rec_SalesHeader.HasLinks then
recEnquiries.CopyLinks(rec_SalesHeader);
recEnquiries.Insert(true);
InsertSalesLine(recEnquiries.No);
end;
until rec_SalesHeader.Next() = 0;
end;
I used copylinks before insert is it right?
Please help
Yes,tried, this one is working thankyou
Try this code to copy the notes
if Rec.HasLinks then
ToSalesHeader.CopyLinks(Rec);
I have updated my code somthing like this still my notes is not getting copied to my new update sales order.
if ToSalesHeader.FindFirst() then begin
if not rec.isArchive then begin
cu_CopyDocumentMgt.SetProperties(true, false, false, false, false, false, false);
cu_CopyDocumentMgt.CopySalesDoc("Sales Document Type From"::Order, rec.No, ToSalesHeader);
rec_EnquiriesLine.SetRange("Document No.", Rec.No);
if rec_EnquiriesLine.FindSet() then begin
SourceRecordLink.SetRange("Record ID", Rec.RecordId);
if SourceRecordLink.FindSet() then begin
LastLinkID := 0;
LastLinkID += 1;
SourceRecordLinkA.Init();
SourceRecordLinkA.Copy(SourceRecordLink);
SourceRecordLinkA."Record ID" := ToSalesHeader.RecordId;
SourceRecordLinkA.Insert();
Message('%1', Rec.RecordId);
end;
PAGE.Run(PAGE::"Sales Return Order", ToSalesHeader);
end;
end;
This is code please anything missing that can be done.
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,232 Super User 2024 Season 2
Martin Dráb 230,064 Most Valuable Professional
nmaenpaa 101,156