Announcements
Hello Experts,
I need someone to help me with how I can prevent inserting duplicate values in external document numbers on the page "Posted Sales Inv. - Update".
Thank you very much for your time and your help Mr. Mohana.
try this
Your answer is always short and useful. Thank you for your support Mr.ZHU
I benefited greatly from the link you provided
Hi, I checked this page, there is no "External Document No." field in the standard, did you customize it?
When customizing this page, in addition to adding new fields, there are still points that need attention. I hope the following information can give you some tips.
For validation checks, you can look at the code below.
pageextension 50116 MyExtension extends "Posted Sales Inv. - Update" { layout { addafter("No.") { field("External Document No."; Rec."External Document No.") { ApplicationArea = All; trigger OnValidate() var SalesInvHeader: Record "Sales Invoice Header"; begin SalesInvHeader.Reset(); SalesInvHeader.SetRange("External Document No.",Rec."External Document No."); if not SalesInvHeader.IsEmpty then Error('Duplicate values in External Document Number'); end; } } } }
Thanks
ZHU
Thanks for your help, Mr. Mohana.
I solved this problem by "OnValidate trigger " as you advised me.
You can start with learning AL from the below link
learn.microsoft.com/.../devenv-get-started
You have to write code on OnValidate trigger of the External Document No. field and check if that value is present in Sales Invoice Header's external document no. field except the current document.
Maybe you can start implementing the logic and ask us if you are facing any issues.
André Arnaud de Cal...
294,261
Super User 2025 Season 1
Martin Dráb
232,996
Most Valuable Professional
nmaenpaa
101,158
Moderator