Script runs on MAS90, but not on MAS200. Is there a trick?
I wrote a simple script (the only kind I know how to write) that calculates the SO Line item GM% based on the item std cost. this is based on an SO Det UDF pulling in the item std cost, then the script based on that and the unit price.
It works just hunky dory on MAS90, but doesn't do diddly squat in MAS200 (technical terms).
Any ideas? - Script is below
'Calculate GM% based on unit price and std cost
'UDF_STD_COST
'LastAllocatedUnitCost
'UnitPrice
'UDF_GM
nUDF_STD_COST = 0
nUnitPrice = 0
nUDF_GM = 0
retVal = oBusObj.GetValue (""UDF_STD_COST"",nUDF_STD_COST)
retVal = oBusObj.GetValue (""UnitPrice"",nUnitPrice)
if nUnitPrice = 0 then
retVal = oBusObj.SetValue (""UDF_GM"",0)
end if
if nUnitPrice <> 0 then
retVal = oBusObj.SetValue(""UDF_GM"",((nUnitPrice - nUDF_STD_COST)/nUnitPrice)*100 )
end if