Version 4.5 creating script form WT Template budget costs to update STD cost in Inventory.
I added a button to the Work Ticket Template, on the Additional tab.
Template number = Item number
When the button is clicked, we want to update the CI_Item (Item Master) with the Budget Materials Cost. I have tried the update of the Standard cost (They use Lifo and I try using a numeric UDF)
I keep getting to the Msgbox Error.
itemCode = """"
oItem = 0
savcost = 0
retVal = oBusObj.GetValue(""TemplateNo$"", itemCode)
retVal = oBusObj.GetValue(""BudgetMaterialsCost$"", savcost)
oItem = oSession.GetObject(""CI_Item_bus"")
If oItem <> 0 Then
Set oItem = oSession.AsObject(oItem)
retVal = oItem.SetKey(itemCode)
retVal = oItem.SetValue(""StandardUnitCost$"", savcost)
retVal = oItem.Write()
retVal = oSession.DropObject(""CI_Item_bus"")
Else
' could not get object for some reason
' add error message here - if you like
MsgbOX(""ERROR"")
End If