Hi All,
I am missing something here with this script. The purpose is to fill in an "industry" UDF in the customer file with the data pulled from the UDT. The key in the UDT is the possible entries for the custom type. The message box shows that it is finding the correct value but it does not update the field in the customer table. I had originally tried doing it as a column script (that is why the Write line is there) but it did not work. Now it is a pre-write. Any guidance on why it's not filling in the field would be appreciated.
'Set Customer Industry
' Desc: Pulls in customer industry based on customer type
' Bus Object: Main: AR_Customer_bus
' Event: Pre-Write
' By Bob Osborn/ ACI
' ----------------------------- SCRIPT START -------------
'Init VARs
sType = "" : sIndustry = ""
if oSession.UserCode = "ACI" then
retVal = oBusObj.GetValue("CustomerType$", sType)
sMsg = "Type: " & sType
'retMsg = oSession.AsObject(oSession.UI).MessageBox("", sMsg)
Set oUDT = oSession.AsObject(oSession.GetObject("CM_UDTMaint_bus", "AR_UDT_INDUSTRY"))
'Set oUDT = oSession.GetObject("CM_UDTMaint_bus", "AR_UDT_INDUSTRY")
'If oUDT <> 0 Then
' Set oUDT = oSession.AsObject(oUDT)
'Else
' sMsg = "Error: Could not access AR_UDT_INDUSTRY"
'
' retMsg = oSession.AsObject(oSession.UI).MessageBox("", sMsg)
' Exit Sub
'End If
'If Len(sType) <> 0 Then
retVal = oUDT.Find(sType)
retVal = oUDT.GetValue("UDF_INDUSTRY$", sIndustry)
sMsgA = "Ind: " & sIndustry
retMsg = oSession.AsObject(oSession.UI).MessageBox("", sMsgA)
retVal = oBusObj.SetValue("UDF_INDUSTRY$", sIndustry)
' retVal = oBusobj.Write()
'End If
end if
------------------------------
Bob Osborn
Consultant
ACI Consulting
------------------------------