When we are not given the external Document No. we should not allow to insert Sales lines in the sales order, I am attaching my code what I have tried but I did not get it and can you share me any example how we can do it.
When we are not given the external Document No. we should not allow to insert Sales lines in the sales order, I am attaching my code what I have tried but I did not get it and can you share me any example how we can do it.
Hi, please try the following.
tableextension 50109 MyExtension extends "Sales Line" { trigger OnBeforeInsert() var SalesHeader: Record "Sales Header"; Text000: Label 'The external document No. have to be given'; begin if SalesHeader.Get(SalesHeader."Document Type"::Order, Rec."Document No.") then if SalesHeader."External Document No." = '' then Error(Text000); end; }
Thanks.
ZHU
Hi,
Please follow as below -
[EventSubscriber(ObjectType::Codeunit, 414, 'OnBeforeReleaseSalesDoc', '', false, false)]
local procedure MyProcedure(var SalesHeader: Record "Sales Header")
begin
SalesHeader.TestField(ExtDocNo);
end;
Thanks,
Tanya Kharbanda
Don't forget to help the community by verifying the answer if your question has been answered. It will let others know that the topic has a verified answer.
Hi
Please see suggestions in this post
community.dynamics.com/.../i-need-to-do-external-document-no-as-mandatory
Sohail Ahmed
686
YUN ZHU
646
Super User 2025 Season 1
Mansi Soni
495