Sage 100

 View Only
  • 1.  I have a Sales Order script that is failing when I

    Posted 03-17-2017 11:52
    I have a Sales Order script that is failing when I launch the order from Customer Maintenance. Not the first time, but the second. Consistently. I am running Sage 100 Advanced. The error seems to be that oScript is reset, as the error message says that DebugPrint is not a method of oScript. (It worked the first time!) Has anyone seen anything like this before?


  • 2.  RE: I have a Sales Order script that is failing when I

    Posted 03-17-2017 11:57
    @Sage100AdvancedScripting


  • 3.  RE: I have a Sales Order script that is failing when I

    Posted 03-17-2017 12:24
    It should have been in Advanced Scripting! Thanks Brett.


  • 4.  RE: I have a Sales Order script that is failing when I

    Posted 03-17-2017 12:53
    Is the script running from the server or client? What language are you using? VBScript?


  • 5.  RE: I have a Sales Order script that is failing when I

    Posted 03-17-2017 13:10
    On the server. It's VBScript.


  • 6.  RE: I have a Sales Order script that is failing when I

    Posted 03-17-2017 13:16
    Is it a button script or event-driven? I've encountered Error 88s occasionally from button-scripts, but when I try them again (usually immediately), they'll work. It always felt like the server was busy at that moment.


  • 7.  RE: I have a Sales Order script that is failing when I

    Posted 03-17-2017 13:32
    It's event driven, at postTableRead. It errors consistently on the second time I try to launch a Sales Order within Customer Maintenance. Thanks for your response!


  • 8.  RE: I have a Sales Order script that is failing when I

    Posted 03-17-2017 13:57
    And does the error reference the first line in your script? If you REM out the oScript line, will it error on the next instead? Has it ever worked? I wonder if the script actually thinks oBusObj is AR Customer instead of Sales Order...


  • 9.  RE: I have a Sales Order script that is failing when I

    Posted 03-17-2017 23:57
      |   view attached
    Hey Rob when you say launch the order do you mean show the SO Entry UI? If so I have a sample of such a thing (attached) that launches the 1st order for the customer on the screen via PostRead with several DebugPrint's (it serves a training purpose). I show difference between .Process (child window) vs InvokeProgram (independent window). But if you're saying you're trying to re-use an existing script in Customer Maint that works OK directly in S/O Entry, then what Steve says is correct that your current oBusObj (your coBusiness) is AR_Customer_bus. You would need to do a GetObject using say oSO like my sample except it will point to SO_SalesOrder_bus. Maybe something like this: isButtonScriptOrUIScript = IsObject(oUIObj) If isButtonScriptOrUIScript = False Then Set oUIObj = oSession.AsObject(oScript.UIObj) 'oUIObj already present from a button or UI Script but not for event script End If screenName = oUIObj.GetScreenName() If UCase(screenName) = UCase(""SO_SalesOrder.m4l"") Then 'run current code Else 'run alternate code Set oSO = oSession.AsObject(oSession.GetObject(""SO_SalesOrder_bus"")) 'Replace all oBusObj references with oSO .. End If

    Attachment(s)

    txt
    AR_Launch_SOrder.txt   2 KB 1 version


  • 10.  RE: I have a Sales Order script that is failing when I

    Posted 03-18-2017 16:13
    3am, @AlnoorCassim?!? I want to party on St Paddy's day with you next year!