We have a simple Sales Order Entry script to calculate the total QuantityOrdered if the UDF in Product Line flag is set to "Y" and populate the total into a UDF on the Sales Order Header. Script works great in Sage 100 2020 Advanced.
When we run the script in Sage 2022 Premium the script runs but does not total the QuantityOrdered.
The script is below:
If oSession.CompanyCode = "TST" Then
retMsg = oSession.AsObject(oSession.UI).MessageBox("", "script fired ")
'Init Variables
sItemType=""
sItemCode=""
sProdLine=""
nTotOrd=0
sFilter=""
set oLines = oSession.AsObject(oBusObj.Lines)
retval=oLines.MoveFirst()
Do Until cBool(oLines.eof)=True
retVal=oLines.GetValue("ItemType$",sItemType)
retVal=oLines.GetValue("ItemCode$",sItemCode)
'retMsg = oSession.AsObject(oSession.UI).MessageBox("", sItemCode)
If sItemType="1" then
If IsObject(oItem)=False then
Set oItem=oLines.AsObject(oLines.GetChildHandle("ItemCode"))
End If
retVal=oItem.Find(sItemCode)
retval=oItem.GetValue("ProductLine$",sProdLine)
'retMsg = oSession.AsObject(oSession.UI).MessageBox("", sProdLine)
Set oProdLine=oSession.AsObject(oSession.GetObject("IM_ProductLine_svc"))
retval=oProdLine.Find(sProdLine)
retVal=oProdLine.GetValue("UDF_Filters$",sFilter)
'retMsg = oSession.AsObject(oSession.UI).MessageBox("", sFilter)
If sFilter="Y" then
retval=oLines.GetValue("QuantityOrdered",nOrder)
nTotOrd=nTotOrd+nOrder
end if
end If
retVal=oLines.MoveNext()
Loop
retVal=oBusObj.SetValue("UDF_Filters",nTotOrd)
End If
------------------------------
Doug Clark
Ardent Consulting LLC
------------------------------