I cannot get this script to work because it is not reading in the UDF from the SO_ShipToAddress file. I'm trying to fire a message and disallow the Ship to Address from being selected if it is marked as "obsolete" with a checkbox UDF (Y/N).
'Desc: Do not allow SO Ship to Code to be used in SO Entry if Obsolete Ship To address UDF checkbox is selected on
'Event: Post-Validate on Ship To code field
'==========================================
sObsShipTo = "" : sShip2Code = ""
If oSession.CompanyCode <> "ZZZ" Then
Exit Sub
End If
If oSession.StartProgram = "SO_SALESORDER_UI" Then
Set oShipTo = oSession.AsObject (oSession.GetObject("SO_ShipToAddress_svc"))
retVal = oShipTo.GetValue("UDF_OBSOLETE_SHIP_TO$", sObsShipTo)
retVal = oScript.DebugPrint("Obsolete Ship To?: " & ObsShipTo)
if sObsShipTo = "Y" Then
retVal = oScript.SetError("Invalid/Obsolete Ship To Address.") 'Used to fail any of the "Pre" procedures
retVal = oScript.InvokeButton("fldr.PHEADER")
end if
end If
------------------------------
Jane Scanlan
Partner
Next Level Manufacturing Consulting Group
------------------------------