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
  • 0
    This is the script I use to write out the order writers name to a UDF which displays the name of the order writer. You should be able to use the same process to get what you need.

    Sub PostValidation_CustomerNo500(column,value)

    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 had this script running in Sage 2014 and 2018.  Now, I recently updated to 2022.1, and it does not work. 

    In BigLouie's script, sCKey has a 10 digit value, but sKey is Null.  sKey comes from the GetChildHandle call, so I worry that there is a field that was renamed or something changed in that table.  I think the table should be SY_User_SVC, but I seem incapable of finding or reading what should be called here.  The 'sFirst' is also null.  I did not pull sLast into a message box to see it, but I figure the other two values are null, that would be also. 

    Has anyone dealt with this?  Can you lead me to 1. ideally a fix to the script or 2. a way to see what the field would be called in the child handle?  

    Thank you,

    Chris

  • 0 in reply to Beevet
    SUGGESTED

    I figured this out thanks to this post by Kevin M, who credited David Speck: 

    https://www.sagecity.com/us/sage100_erp/f/sage-100-business-object-interface/174328/pre-totals-script---accessing-item-information-using-olines-getchildhandle-itemcode/445343#445343

    The trick was to add a ReadAdditional call before calling the child handle.  I added one line, which was

    retVal = oBusObj.ReadAdditional("UserCreatedKey")

    immediately before 

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

    Now the UDFs for names are filled.  

    I do not know why this was needed.  I did find the SY_USER table in MAS_System folder.  Everything looked like it was supposed to, there were no name changes or anything else obvious to me.  I suspect something changed in the underlying Sage code that is now different that requires this call? 

    Thank you for considering this. 

    Chris

Reply Children
  • 0 in reply to Beevet

    I've found the ReadAdditional is most useful when it comes to objects that have multiple fields linked to the reference table.  UserCreatedKey and UserUpdatedKey both link to SY_User.  (And in an SO Line, SalesAccountKey and CostOfGoodsSoldAccountKey both link to GL_Account).  The ReadAdditional ensures you are grabbing the right handle.

  • 0 in reply to Kevin M

    Why does this script work ok in older versions but not in 2022?  Is there something that changed or was this script just getting away with something?  

    Thank you for the explanation you provided of the ReadAddidional, this helps as I am trying to learn

    Chris

  • 0 in reply to Beevet

    I don't know of anything specific, but generally speaking, with new versions Sage often adds new features, requiring changes to the code behind the scenes.  That's why enhancements need to be verified as compatible with all Sage updates (versions, PU, hotfixes...). While it is much less common to require script updates with new versions, it can happen.