I've created a script to automatically populate the Ship To Address Code, depending on what warehouse code is assigned to the PO header. It is not working and am hoping that someone can offer me some help. I'm obviously less than a novice when it comes to scripting, but thought I could at least do this simple script ... but no I can't.
'Title: PO_Dflt_Ship_To
'Desc: Get Ship To Code based on Warehouse Code
'Bus Object: PO_PurchaseOrderHeader
'Event: Table Pre-Write
'By Jane Scanlan
'
' -------------------------SCRIPT START ------------------------------------
If oSession.CompanyCode <> "JPS" Then
Exit Sub
End If
sWhse = "" : sShipTo = ""
retVal = oBusObj.GetValue("WarehouseCode$", sWhse)
retVal = oScript.DebugPrint("Warehouse = " & sWhse)
retVal = oBusObj.GetValue("ShipToCode$", sShipTo)
retVal = oScript.debugPrint("Ship To Code = " & sShipTo)
if sWhse = "100" then
retval = oBusObj.setValue("ShipToCode$",100)
if sWhse = "200" then
retval = oBusObj.setValue("ShipToCode$",200)
if sWhse = "300" then
retval = oBusObj.setValue("ShipToCode$",300)
end if
end if
end if
------------------------------
Jane Scanlan
Partner, Next Level Manufacturing Consulting Group
Next Level Manufacturing Consulting Group
Chanhassen MN
952-210-7758
------------------------------