Need to test record before moving to new record on form

happyjoyhappyjoy Member Posts: 10
My customer has two order entry methods. On the customized version ONLY they want to check to be sure that one of two flags is set on the order header before allowing the user to go to a new order (either by inserting, paging up/down, or ending the sesssion). The goal is to force the user to set one of the flags before leaving the order.

I'm not sure how to do this and have it not close the form. Any error on the form triggers seems to do this. Yet, I can't put code on the record unless I find a way to condition it to the customized entry form only.

Any ideas (...she says on bended knee!)? :roll:
"For in much wisdom is much grief, and he who increases knowledge increases sorrow." - Eccl. 1:18

Comments

  • SavatageSavatage Member Posts: 7,142
    onQuerycloseform()
    if NOT Flag1 and NOT Flag2
    THEN BEGIN
      MESSAGE('You MUST enter a value into one of the flags! DOH!");
        EXIT(FALSE);
    END;
    

    but you'll need to add some code in other places - like on next record, etc etc.

    if you search the forum for "mandatory fields" you'll probably get some other good ideas.
  • David_SingletonDavid_Singleton Member Posts: 5,479
    happyjoy wrote:
    My customer has two order entry methods. On the customized version ONLY they want to check to be sure that one of two flags is set on the order header before allowing the user to go to a new order (either by inserting, paging up/down, or ending the sesssion). The goal is to force the user to set one of the flags before leaving the order.

    I'm not sure how to do this and have it not close the form. Any error on the form triggers seems to do this. Yet, I can't put code on the record unless I find a way to condition it to the customized entry form only.

    Any ideas (...she says on bended knee!)? :roll:

    You can eventually get this to work, using Harry's suggestion , this is a case of you trying to solve a bud business process with code. This just is not how NAV works. Instead talk with the client not about HOW they want to achieve this, but WHY, as in what are they trying to achieve.

    This "solution" will have lots of repercussions, and you will be continuously be writing fixes.

    Look for a solution where the user can enter the order the NAV way, and trigger the warning or what ever at some later point with a different trigger.
    David Singleton
  • kinekine Member Posts: 12,562
    I fully agree with David on this. You can do that, but it is not good way, because other users which are just listing the orders will be annoyed by this, because it is not their fault that something is missing.

    If the checkboxes must be checked before someone start the posting, better is to check them before the posting (e.g. during Release of the document).
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • SavatageSavatage Member Posts: 7,142
    happyjoy wrote:
    I'm not sure how to do this and have it not close the form. Any error on the form triggers seems to do this.

    Any ideas (...she says on bended knee!)? :roll:
    I agree as above, but I also wanted to show that it is possible to stop the closing as asked 8)
Sign In or Register to comment.