Sales Order Button to Mark Pick Sheet Printed

SUGGESTED

We have a WMS integration that relies on the field PickingSheetPrinted = Y and was wondering how I could create a button to set that field to Y, without having to go through the print preview process when you use the actual button?

  • 0

    That would a simple button script to set the value of the field. What have you tried.

  • 0 in reply to BigLouie

    I've tried a couple of variants in a .vbs script but essentially:

    SO_SalesOrder_bus_PickingSheetPrinted = Y
    msgbox("Accept Changes to Salesorder to release to WMS")

    I've tried it with SO_SalesOrder_bus_PickingSheetPrinted$

    and have the Y in "" or ''

  • 0 in reply to RedemptionMatt

    If your script is configured to execute on the client, then the 2nd tab of the button configuration should look like this. 

    The script should look like this.

    SO_SalesOrder_bus_PickingSheetPrinted = "Y"

    A script running on the client can only access variables passed in by those fields that are added to the variable list box. You can use the VBScript's MsgBox to display a message to the user.

    Use this button to add variables to the variable list.


    If your script is configured to execute on the server, then the 2nd tab of the button configuration should look like this. 

    The script should look like this.

    oBusObj.SetValue "PickingSheetPrinted$", "Y"

    A script running on the server can access the object handles that are passed into the script, such as oBusObj, oSession, oUIObj, and oScript. You can use these object handles to do a lot more than what a simple script on the client can do. You CANNOT use VBScript's MsgBox but instead can use the following.

    oSession.AsObject(oSession.UI).MessageBox "", "Your message here"

  • 0 in reply to David Speck

    My setup is on the first example, however I am running the client on the server. Could that be the issue? I need to set it up like example 2?

  • 0 in reply to RedemptionMatt

    You do know that if you have it running on the server the message box will open up on the server and not on the work station for anyone to see.

  • 0 in reply to BigLouie

    I have the script executing on client, like David's first example. I am just testing on our server using the client installed on it.

  • 0 in reply to David Speck

    When executing on client, is it possible to "save" with the same button so we don't have to click "ok" on the message box & then click Accept? Trying to remove 2 extra clicks if possible.

  • 0 in reply to RedemptionMatt
    SUGGESTED

    It may be the field is read only in the business object.  I'd try a column post validate on a UDF checkbox with a simple SetValue (instead of a button... avoiding all those issues).

    retVal = 0
    
    retVal = oBusObj.SetValue("PickingSheetPrinted$", "Y")
    
    if retVal <> 1 then
    
        retVal = oSession.AsObject(oSession.UI).MessageBox(" LastErrorMsg: " & oBusObj.LastErrorMsg)
    
    end if

  • 0 in reply to RedemptionMatt

    Not without a hook to a file with providex perform logic.

    Much easier to just have it execute on the server, the script will still work from other workstations. Then at the end of the button script, you would have the either of the following to simulate the Accept button being clicked.

    This version will invoke the method at that point in the script and will not advanced in the script until the method completes.

    oUIObj.BT_Accept

    This version queues the button to be invoked once the script has finished being processed.

    oScript.InvokeButton "BT_Accept"

  • 0 in reply to Kevin M

    On 2018, i was able to set the value of "PickingSheetPrinted$" to "Y" with a button script.

    However, , do you need this value to be set on every order or does it really depend on a user to click your button because of outside criteria needing to be met prior?

    If it needs to always be set, then you should consider using the SO_SalesOrderHeader table's pre-write event instead that way it will always set the value for new or edited orders when the user goes to save the changes.