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

Parents
  • 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. 

Reply
  • 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. 

Children
No Data