Sage 100

 View Only
  • 1.  OnExit script triggering one last time when closing SOE task

    Posted 05-09-2019 11:34
    ​​

    Good morning all - I was hoping I could get your opinion on  something quirky. I have a script to check for blank Customer PO/Ship Via in Sales Order Entry using OnExit from the Header tab. It works fine for normal data entry but my "fields are blank" message pops up one more time when I close the Sales Order Entry task too. I might just change to a pre-write script instead, but any idea why the script is running one more time at that point, or how to stop it? Thanks in advance!
    #scripting



    ------------------------------
    Amber Prayfrock, Blytheco
    ------------------------------


  • 2.  RE: OnExit script triggering one last time when closing SOE task

    Posted 05-09-2019 11:36
    Check for a blank SO # too before your SetError.  You only want it to trigger when there is an open SO. ​

    ------------------------------
    Kevin Moyes
    Technical Systems Analyst
    Munjal White Consulting Co.
    Toronto ON
    ------------------------------



  • 3.  RE: OnExit script triggering one last time when closing SOE task

    Posted 05-09-2019 11:49
    ​Well, that would make sense :) I can work that in. I just don't recall this happening any other time I've put in an OnExit script, but should be easy enough to fix. Thanks, Kevin!

    ------------------------------
    Amber Prayfrock, Blytheco
    ------------------------------



  • 4.  RE: OnExit script triggering one last time when closing SOE task

    Posted 05-09-2019 11:54
    It's really only an issue when you have a SetError, based on a blank field value.
    (I first learned of the problem / solution during Alnoor's scripting class back in NOLA, pre-Summit a few years ago).

    ------------------------------
    Kevin Moyes
    Technical Systems Analyst
    Munjal White Consulting Co.
    Toronto ON
    ------------------------------



  • 5.  RE: OnExit script triggering one last time when closing SOE task

    Posted 05-09-2019 23:27
    Edited by David Speck II 05-10-2019 12:42
    Basically what Kevin said, check to make sure you are not on a record, you can do this usually by checking the oBusObj.EditState = 0, the oBusObj.GetKey() = "", or by using oBusObj.GetValue on a field that makes up the primary key and checking if it is blank.

    ------------------------------
    David Speck II
    Tennessee Software Solutions
    ------------------------------



  • 6.  RE: OnExit script triggering one last time when closing SOE task

    Posted 05-10-2019 08:19
    Thank you both!

    ------------------------------
    Amber Prayfrock, Blytheco
    ------------------------------