Scripting

  • 1.  I have a button script on Shipping data entry to e

    Posted 02-03-2017 08:56
    I have a button script on Shipping data entry to export a text file, which works fine. v2015 Premium, server side button script. The process is to click my button, then the user clicks Accept which starts packing slip printing. Now, the customer wants my button to Accept after the file export, and start the packing slip printing automatically... but the following code only saves the shipment. The Packing Slip Printing dialog does not show up. retVal = oScript.InvokeButton(""BT_ACCEPT"") Any ideas? I tried adding this after the invoke command, but nothing changed. retVal = oUIObj.HandleScriptUI() I could probably switch to invoking the quick print button but I am curious why invoking BT_ACCEPT doesn't work the same way as actually clicking on it.


  • 2.  RE: I have a button script on Shipping data entry to e

    Posted 02-03-2017 09:09
    Nope, switching to BT_QUICKPRINT doesn't work. The record doesn't get saved.


  • 3.  RE: I have a button script on Shipping data entry to e

    Posted 02-03-2017 09:42
    I would've thought the same thing. Does the Quick Print close the record, or can you combo the two buttons? The object reference lists a SO_PackingListQuickPrint_UI object, with one property (QuickPrint$), so I wonder if you need to hit that after your BT_Accept? Sorry, not much help.


  • 4.  RE: I have a button script on Shipping data entry to e

    Posted 02-03-2017 09:55
    Invoking quick print opens the print dialog, closes the record but doesn't save the record. I was thinking about chaining them too, but didn't even try, because both invoke options close the record, so I suspect the handle would be gone before the second invoke. :-/


  • 5.  RE: I have a button script on Shipping data entry to e

    Posted 02-03-2017 10:49
    Long story short this part of Shipping Data Entry is not scripting conducive. Since your export code runs server side anyway, would you be able to move that to the Table Pre-Write event? If that ends up working be sure to condition it to only run when oSession.StartProgram = ""SO_SHIPPING_UI


  • 6.  RE: I have a button script on Shipping data entry to e

    Posted 02-03-2017 12:45
    Thanks Alnoor. I have some error conditions in the script where I just pop-up a message and exit sub... which would have to be re-written as conditional SetError lines if I was to switch the trigger. I'll check with the customer to see if the functionality is worth the extra scripting time.