Scripting

  • 1.  Does oScript.InvokeButton(""fldr.pHeader"") have the

    Posted 06-27-2017 18:53
    Does oScript.InvokeButton(""fldr.pHeader"") have the same limitations as the message boxes for Sage 100 Advanced? I have a script that works fine on the server but it isn't working for end users. I've made sure they are not using the wide panel but after that I'm stumped. Does anyone know what I'm missing or why it wouldn't be working on the workstations?


  • 2.  RE: Does oScript.InvokeButton(""fldr.pHeader"") have the

    Posted 06-27-2017 19:09
    Is it a button script or event driven?


  • 3.  RE: Does oScript.InvokeButton(""fldr.pHeader"") have the

    Posted 06-27-2017 19:37
    What Steve said. Is it a button script that is set to Execute On Client? Of course that means they should also be getting a oScript is not an object error then. Also it wouldn't work if you had already done an InvokeButton earlier in your script to another control because at that point script execution is done.


  • 4.  RE: Does oScript.InvokeButton(""fldr.pHeader"") have the

    Posted 06-27-2017 21:01
    man - sorry for the total lack of information! This is a UI script on panel- onexit for PHeader. The script is checking the warehouse on the header tab of Purchase Order Entry and if it is ""TMP"" then seterror and then it (should) return the user to the header tab so they can pick a different warehouse. Works as designed on the server but the end users are telling me that they click ""OK"" to the setError message and then are advanced to the lines tab without having to change the header warehouse.


  • 5.  RE: Does oScript.InvokeButton(""fldr.pHeader"") have the

    Posted 06-27-2017 21:09
    i'm not entirely sure of your reason for validating the warehouse in a post exit event when you should be able to achieve exactly what you want with a pre-validation event on the warehouse code on the header. If i'm not mistaken, oScript.SetError can only enforce on a pre-validation event. I'm sure someone else will confirm.


  • 6.  RE: Does oScript.InvokeButton(""fldr.pHeader"") have the

    Posted 06-27-2017 22:41
    Breck - The Ignore_Exit might work better for you on a UI script, something like this. Should work but caveat is the script fires off not only when you visit another panel and conditions aren't met but also if you try to hit the X in the top right to close (cancel) the whole screen. One has to click the Cancel button instead. You should test the heck out of this before deploying. 'PO_Panel_OnExit_IgnoreExit whse = """" retval = oBusObj.GetValue(""WarehouseCode$"", whse) r=oScript.DebugPrint(""whse = "" & whse) r=oScript.DebugPrint(""oBusObj.EditState = "" & oBusObj.EditState) r=oScript.DebugPrint(""oBusObj.RecordChanged = "" & oBusObj.RecordChanged) If (whse = ""TMP"" and oBusObj.EditState = 2) Then retVal = oUIObj.SetVar(""IGNORE_EXIT"", 1) 'prevents exit of panel sMsg = ""Oops the Whse Code is stil TMP."" & vbCrLF & ""Lotus and Jewel say you can't pass GO."" retMsg = oSession.AsObject(oSession.UI).MessageBox("""", sMsg,""Title=Warehouse Code Check,Icon=!"") ElseIf (whse = ""TMP"" and oBusObj.EditState = 1 and oBusObj.RecordChanged = 1) Then retVal = oUIObj.SetVar(""IGNORE_EXIT"", 1) 'prevents exit of panel sMsg = ""Oops the Whse Code is stil TMP."" & vbCrLF & ""Lotus and Jewel say you can't pass GO."" retMsg = oSession.AsObject(oSession.UI).MessageBox("""", sMsg,""Title=Warehouse Code Check,Icon=!"") Else retVal = oUIObj.SetVar(""IGNORE_EXIT"", 0) 'intentionally set the opposite state if above conditions not met End If


  • 7.  RE: Does oScript.InvokeButton(""fldr.pHeader"") have the

    Posted 06-28-2017 11:00
    Thanks everyone for the help! I especially like the Lotus and Jewel part of Alnoor's script. This one falls under the ""never trust a client"" category. They swore up and down that they weren't using the wide view but just to be safe I wrote a second script for fldr.pheaderw and lo and behold it works. But I am loving the IGNORE_EXIT idea, another weapon in the tool kit!