User Defined Scripts to populate a UDF

SOLVED

I'm creating a script to auto-populate an SO_Detail UDF (UDF_SHIP_REF1) so that I can pass data to StarShip.  The goal is to concatenate the item number with the Customer PO Number (i.e. "3131000 / 123456789" )

I have developed a more detailed script (at the bottom of this post), but it doesn't work.

In trying to build on any success, I stripped out everything to just get a single bit of data into the UDF.  Again, without success

Any Ideas where I'm off?

STRIPPED SCRIPT

dim ref1

ref1 = ""

ref1 = "Testing of UD scripting"

retval = oBusObj.SetValue("UDF_SHIP_REF1$", ref1) 'into so_salesorderdetail.

DETAILED SCRIPT

dim retVal

dim item
dim po
dim ref1

item = ""
po = ""
ref1 = ""

retVal = oBusObj.GetValue("ItemCode$", item) ' from so_salesorderdetail.

oBusObj.ReadAdditional "SONumber"
oSession.AsObject(oBusObj.GetChildHandle("SONumber")).GetValue "CustomerPONo$", po

'ref1 = item & " / " & po
ref1 = "Testing of UD scripting"

retval = oBusObj.SetValue("UDF_SHIP_REF1$", ref1) 'to so_salesorderdetail.

Parents
  • 0

    What event are you using?  Adding the script to UDS maintenance doesn't make it active.  You have to then attach the script to an event for it to work.

    Edit: I misread the OP... I see CPV on QuantityOrdered.  How are you testing?  If your UDF is in the upper grid, it might be working, but simply not refreshing what you see on screen until you click off Lines and back.

    For the CustomerPONo, use retVal = oHeaderObj.GetValue(... instead of your child handle.

  • 0 in reply to Kevin M

    Be sure to re-compile after each change, and re-open your SO Entry to load the updated script.

Reply Children
No Data