Log who printed Picking Sheet

SUGGESTED

I am trying to create a script that writes the current user key when the user prints the picking sheet. Has anyone done this before? My script doesn't appear to work and I am unsure which event I should use to accomplish. My code is below:

retVal = 0
isPrinted = "N"
printedBy = ""

retVal = oBusObj.GetValue("PickingSheetPrinted$", isPrinted)
retVal = oBusObj.GetValue("UDF_USER_PRINTED$", printedBy)

If isPrinted = "Y" Then


retVal = oBusObj.SetValue("UDF_USER_PRINTED$", printedBy)


Elseif isPrinted = "N" AND printedBy <> "" Then


retVal =oBusObj.SetValue("UDF_USER_PRINTED$",oSession.UserKey)


End If

  • 0

    This is the script I use to take the user ID and write out their name to a UDF. You should be able to see how to use this to do what you want.

    sFirst = "" : sLast = "" : sKey= "" : sCKey = ""

    retVal = oBusObj.GetValue("UserCreatedKey", sCKey)

    Set oUser = oBusObj.AsObject(oBusObj.GetChildHandle("UserCreatedKey"))

    retVal = oUser.getvalue("UserKey$",sKey)
    retVal = oUser.getvalue("FirstName$",sFirst)
    retVal = oUser.getvalue("LastName$",sLast)

    If sKey = sCKey then
     retVal = oBusObj.SetValue("UDF_FIRST$", sFirst)
     retVal = oBusObj.SetValue("UDF_LAST$", sLast)

    end if

  • 0 in reply to BigLouie

    I don't need the username of the created key. I want the user key (it could be user code as well) that printed the order. I need the user who changed the PickingSheetPrinted from Y to N whether through Picking Sheet Printing or through Quick Print. My understanding is the oSession.UserKey should get me the user key of the session user. However I tried using post validate on the PickingSheetPrinted as well as post Table Write and the script seems to do nothing. 

  • 0

    Have you found a working solution? Thank you. 

  • 0
    SUGGESTED

    If i recall correctly, i believe it has been pointed out that the sales order printed and picking sheet printed fields are not updated using the BOI and therefore won't trigger events attached to them, the values are instead updated using "legacy" methods. If they are using the Quick Print button, then you could hide the actual button and replace it with a fake button that executes a script to capture the current user when the button is clicked and then invoke the actual button but this isn't perfect since the user may close the quick print window without ever having clicked print/preview.