User field on Sales Order screen

SUGGESTED

Hi ALL,

There is a field called "User" on the Top right on the Sales Order Entry screen. Can we pass the values of that field from the BOI programming?

And Can please tell me that it stores into which table?

Please help me by giving hint to resolve this issue.

Thanks

SF

Parents Reply Children
  • 0 in reply to Kevin M

    If you are only after the name of the user who created the record, you can use the GetChildHandle method (don't add a dollar sign after string columns, it just takes the column name). This will give you handle to the service object and it will be on the current record, ie if the UserCreatedKey is 0000000006 then the service object will be on that record and you can use the GetValue method to read whatever field you are after.

    set oUser_Svc = oSession.AsObject(oBusObj.GetChildHandle("UserCreatedKey"))
    sUserName = ""
    retval = oUser_Svc.GetValue("UserLogon$",sUserName)
    retval = oSession.AsObject(oSession.UI).MessageBox("", "User Name: " & sUserName)

    If you are after the name of the user who last update the record, you will need to get the value for the UserUpdatedKey then use the Find method on the child handle or get your own handle to the SY_User_Svc object. If you use the child handle, make sure you do another Find on the user created key so the UI won't display a different value since you changed the current record when using Find on the UserUpdatedKey value if it is different then the UserCreatedKey.

    sUserCreatedKey = ""
    retval = oBusObj.GetValue("UserCreatedKey$", sUserCreatedKey)
    sUserUpdatedKey = ""
    retval = oBusObj.GetValue("UserUpdatedKey$", sUserUpdatedKey)
    set oUser_Svc = oSession.AsObject(oBusObj.GetChildHandle("UserCreatedKey"))
    retval = oUser_Svc.Find(sUserUpdatedKey)
    if retval = 1 then
    sUserName = ""
    retval = oUser_Svc.GetValue("UserLogon$",sUserName)
    retval = oSession.AsObject(oSession.UI).MessageBox("", "User Name: " & sUserName)
    end if
    retval = oUser_Svc.Find(sUserCreatedKey)
    set oUser_Svc = nothing

    Reply back if you have any questions about the above code.

    Final note, both my script and BigLouie's script use the syntax for BOI executed internally, like from a button executing on the server or a user defined script. I recall in another one of your posts, you were executing externally so you will have to add the "s","n", or "o" before each method and property to identify what kind of value is being returned.