UDF Script on SO Header

SOLVED

Trying to get an UDF populated with a default value depending on the ShipToCode on the SO Header.  I've tried with a table pre-write and a column (ShipToCode) pre and post validate event.  Just need the UPS # to go into the UDF_THIRDPARTYSHIP when the ShipToCode= PHYS.

rVal = 0
nCustomerNo = ""
sshipTo = ""
searchString = "PHYS"

rVal = oBusObj.GetValue("CustomerNo$", nCustomerNo)
rVal = oBusObj.GetValue("ShipToCode$", sshipTo)

If nCustomerNo = "1657000" then

	If InStr(sshipTo, searchString) then
	    rVal = oHeaderObj.SetValue("UDF_THIRDPARTYSHIP$", "111111")
	End if
End if

Parents
  • +1
    verified answer

    The object you need to update is oBusObj, not oHeaderObj.  Change this:

    rVal = oHeaderObj.SetValue("UDF_THIRDPARTYSHIP$", "111111")
    to this:
    rVal = oBusObj.SetValue("UDF_THIRDPARTYSHIP$", "111111")
    Column Post-Validate on ShipToCode is correct, but you might also want to put it on CustomerNo since the ship to code may default from the customer, and I'm not sure if that will trigger.

Reply
  • +1
    verified answer

    The object you need to update is oBusObj, not oHeaderObj.  Change this:

    rVal = oHeaderObj.SetValue("UDF_THIRDPARTYSHIP$", "111111")
    to this:
    rVal = oBusObj.SetValue("UDF_THIRDPARTYSHIP$", "111111")
    Column Post-Validate on ShipToCode is correct, but you might also want to put it on CustomerNo since the ship to code may default from the customer, and I'm not sure if that will trigger.

Children