Sage 100 2020.1 Premium, script on Table prewrite for SalesOrderDetail:
It works for all item types on my test system. On the customer's live system, it does not seem to fire on types 3 or 5, only on 1.
If the item type is 1, I get the messages before the item type check and then the final one where it falls through to else.
However, for item type 3 or 5 (which is where I need it to do stuff) I don't get any of the messages.
sDept = ""
sItemType = ""
sState = ""
LeadTime = Date
oUDT = 0
sUDTDept = ""
sMsgRetVal = oSession.AsObject(oSession.UI).MessageBox("in lead time script")
retVal = oBusObj.GetValue("ItemType$", sItemType)
retVal = oBusObj.GetValue("UDF_DEPARTMENT$",sDept)
sState = oBusObj.EditState
sMsgRetVal = oSession.AsObject(oSession.UI).MessageBox("","EditState " & sState)
if (sItemType = "3" or sItemType = "5") and sDept > "" and oBusObj.EditState = 2 Then
oUDT = oSession.GetObject("CM_UDT_svc", "SO_UDT_CAPACITYBYDEPT")
If oUDT <> 0 Then
Set oUDT = oScript.AsObject(oUDT)
retVal = oUDT.Find(sDept)
if retVal = 1 then
retVal = oUDT.GetValue("UDF_LEADTIME$",LeadTime)
sMsgRetVal = oSession.AsObject(oSession.UI).MessageBox("",Cstr(LeadTime))
retVal = oBusObj.SetValue("UDF_LEADTIME$",cstr(LeadTime))
End if
End If
Else
retVal = oBusObj.SetValue("UDF_DEPARTMENT$","")
End if
------------------------------
Phil McIntosh
President
Friendly Systems, Inc.
------------------------------