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.

  • 0 in reply to hyanaga

    If you use CustomerNo, make sure the default ShipToCode is set by the time the script runs (i.e. confirm through testing).  I've had to use PreTotals occasionally (when other triggers don't cover what I need done).

Reply Children
No Data