web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Routing

(0) ShareShare
ReportReport
Posted on by

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. 

60.PNG

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Nareshwar Raju Vaneshwar Profile Picture
    5,596 on at

    Hi,

    On BOM Routing Header table, OnModify() Trigger,

    RoutingLines.SETRANGE("Document No.", "No.");

    IF RoutingLines.FIND('-') THEN

      ERROR('Routing Lines Exist');

  • Suggested answer
    Binesh Profile Picture
    7,887 on at

    Hello,

    Also Check Table Routing Header [99000763] in

    Status - OnValidate Trigger

    Some code will execute,  analysed that code, you will get Idea.

  • Community Member Profile Picture
    on at

    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?

  • Suggested answer
    Nareshwar Raju Vaneshwar Profile Picture
    5,596 on at

    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.

  • Community Member Profile Picture
    on at

    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

    61.PNG

  • Suggested answer
    Nareshwar Raju Vaneshwar Profile Picture
    5,596 on at

    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;

  • Suggested answer
    Binesh Profile Picture
    7,887 on at

    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;

  • Community Member Profile Picture
    on at

    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 :(

    62.PNG

  • Suggested answer
    Binesh Profile Picture
    7,887 on at

    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.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans