Have 2 scripts in PO Entry. 1st script calculates the item weight per line & puts it into UDF_Extended_Weight. This works fine.
2nd script needs to add up all the Extended Weights & put the total on the Totals tab. I have it as a PreTotals on the PO Header & I am getting an Error 88: Invalid/Unknown Property Name. Running in Standard 100, v2015, ABC company on my test system. When I review the trace window, it loops through 52 times for 2 line items, but each time it is calculating the Total Weight correctly. So, not sure if it is an issue with the loop, like its not stopping correctly, or if its the write portion at the end. I get the error as soon as I move to the Totals tab. Thanks in advance!
Here is the script:
dbgRetVal = oScript.DebugPrint(""Made it to PreTotals"")
ExtWeight=0
RunWeight=0
sItemType = """"
Set oLines = oBusObj.AsObject(oBusObj.Lines)
dbgRetVal = oScript.DebugPrint(""After SET oLines before oLines.MoveFirst() "")
retVal = oLines.MoveFirst()
Do Until (cBool(oLines.Eof))
retval = oLines.GetValue(""UDF_EXTENDED_WEIGHT"",ExtWeight)
retval = oLines.GetValue(""ItemType$"", sItemType)
dbgRetVal = oScript.DebugPrint(""Ext Weight is "" & ExtWeight)
If sItemType = ""1"" Then
RunWeight = RunWeight+ExtWeight
Else RunWeight = RunWeight
End If
dbgRetVal = oScript.DebugPrint(""Total Weight is "" & RunWeight)
retval = oLines.MoveNext()
dbgRetVal = oScript.DebugPrint(""After MoveNext() and Before Loop "")
Loop
If oLines.Eof Then
retVal = oBusObj.SetValue(""UDF_TOTAL_WEIGHT"",RunWeight)
retWrite = oBusObj.Write()
End If