On the Routing page within the lines if there is a line and the user tries to change the status of the routing to certified while the Routing Link Code field is empty then it should error.
How can I write this and where should it be written?
As an example of what i mean in the image below if the user attempted to change this to certified it should error as there isn't a routing link code in one of the lines.
*This post is locked for comments
Hello,
Definitely it will fire.
Do something.
First check Routing Line table and Routing Header table,
Check the link, which field is linked with Routing Header field,
That field you have to filter,
Write something like,
recRoutingLines.SETRANGE("Document No.", "No.");
Then beased on Header table lines are filterd,
Here recRoitingLine is a record variable of Routing Line table.
You wrote
recRoutingLines.SETRANGE("No.", recRoitingLine."No.");
So it get wrong data.
Hi thanks again. I tried to run the code however the recRoutingLines.SETRANGE(recRoutingLines."Document No.", "No."); was throwing an error so I changed it to as you can see in the image below. Regardless it's somehow still not firing the error :(
Hello,
Check this code.
IF (Status <> xRec.Status) AND (Status = Status::Certified) THEN BEGIN
recRoutingLines.RESET;
recRoutingLines.SETRANGE(recRoutingLines."Document No.", "No.");
recRoutingLines.SETRANGE(recRoutingLines."Routing Link Code", '');
IF recRoutingLines.FINDFIRST THEN
recRoutingLines.FIELDERROR(recRoutingLines."Routing Link Code");
CheckRouting.Calculate(Rec,'');
END;
Hi,
Check if this code works. Also, I have not considered other implications. Please add other filters/code if needed.
IF Status <> Status::Certified THEN
BEGIN
recRoutingLines.RESET;
recRoutingLines.SETRANGE(recRoutingLines."Document No.", "No.");
recRoutingLines.SETRANGE(recRoutingLines."Routing Link Code", '');
IF recRoutingLines.FIND('-') THEN
ERROR('Your error message!');
END;
Hi I tried adding a quick soloution into where you suggested however it hasn't seemed to of worked. How can I rewrite this to work properly. Currently it doesn't appear to recognize it at all.
Thanks
Hi,
Then you have to take the code away from OnModify() and put it to OnValidate() trigger of the needed fields. Please adjust the code as per your requirements.
Hope it helps.
Thanks however after trying this code I don't want it to throw an error once the status is changed to Certified and the routing link code is empty. This throws errors when ever anything on the page is changed such as changing the status back to Under Developed from Certified. How can I adjust this?
Hello,
Also Check Table Routing Header [99000763] in
Status - OnValidate Trigger
Some code will execute, analysed that code, you will get Idea.
Hi,
On BOM Routing Header table, OnModify() Trigger,
RoutingLines.SETRANGE("Document No.", "No.");
IF RoutingLines.FIND('-') THEN
ERROR('Routing Lines Exist');
André Arnaud de Cal...
291,965
Super User 2025 Season 1
Martin Dráb
230,836
Most Valuable Professional
nmaenpaa
101,156