Hi friends,
I want to avoid the item id duplication in sales line using CAL code please give any solution.
thanks&Regards,
Ashwini. E
*This post is locked for comments
Hi friends,
I want to avoid the item id duplication in sales line using CAL code please give any solution.
thanks&Regards,
Ashwini. E
*This post is locked for comments
I will support Alexander's answer that you should not completely avoid this because there might be a chances that you are making a Sales Order for the same item but with different Variants.
Hi,
Use the logic as follow:
CLEAR(SalesLine); SalesLine.SETCURRENTKEY("Document Type","Document No.",Type,"No."); SalesLine.SETRANGE("Document Type",SalesHeader."Document Type"); SalesLine.SETRANGE("Document No.",SalesHeader."No."); SalesLine.SETRANGE(Type,SalesLine.Type::Item); SalesLine.SETRANGE("No.",Rec."No."); IF NOT SalesLine.ISEMPTY THEN ERROR('The item no. %1 is already exist',Rec."No.");
Agree with Alexander Ermakov , rather than error show a message which indicates that the item is already been selected.
Hi,
In the OnValidate trigger for No, use SETRANGE
SalesLine.SETRANGE(No.,No.);
IF SalesLine.FINDFIRST THEN
ERROR('The item no. is already used');
I would suggest not to restrict that completely but rather give user a notification so user can decide himself. There might be business cases when two lines with the same item are needed in the sales order.
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,280 Super User 2024 Season 2
Martin Dráb 230,214 Most Valuable Professional
nmaenpaa 101,156