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