Sage 100

 View Only
  • 1.  SO Entry Header OnExit Script Question

    Posted 02-10-2022 21:17
    Good evening! I have a script to check for Ship Date vs. Current Date in Sales Order Entry and the client would like the script to fire On Exit from the Header tab. This works fine except for that the message pops up one more time when I click to 'X' out of the Sales Order Entry task as well. Not a big deal but obviously something I'd like to fix. Is there some UI object I have to "drop" or another trick to prevent this last pop-up on a blank sales order window? Thanks in advance!

    sSystemDate = oSession.SystemDate
    sSOShipExpireDate = ""

    if (oSession.StartProgram = "SO_SALESORDER_UI" or oSession.StartProgram = "SO_CRMSALESORDER_UI") then

    retVal = oBusObj.GetValue("ShipExpireDate$", sSOShipExpireDate)

    if sSOShipExpireDate < sSystemDate then

    sMsg = "Your ship date is in the past. Are you sure that is correct?"
    sMsgRetVal = oSession.AsObject(oSession.UI).MessageBox("",sMsg,"Style=YesNo")

    if sMsgRetVal = "NO" then
    retVal = oScript.InvokeButton("fldr.pHeader")
    end if

    end if

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


  • 2.  RE: SO Entry Header OnExit Script Question

    Posted 02-11-2022 02:30
    You could use GetValue on SalesOrderNo$ and check that it is not blank.  I would say you could also check the oBusObj.EditState property but that may cause errors if it is triggered by an inquiry task that is using SO_SalesOrder_Svc instead of SO_SalesOrder_Bus because the EditState property is not available from the *_Svc classes.  You could of course initialize a variable and then use On Error Resume Next to avoid a hard error.
    nEditState = 0
    On Error Resume Next
    nEditState = oBusObj.EditState
    On Error GoTo 0
    If nEditState <> 0 Then
    	' Your logic here.
    End If​


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



  • 3.  RE: SO Entry Header OnExit Script Question

    Posted 02-11-2022 07:58
    Thanks, David! Checking for the SalesOrderNo worked great. Something so simple :D

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