Hi there,
I have a script that fires on Sales Order Details event Column- Post validate Item Code Field.
In this script I need to access the Customer Price level on the a/r customer record to do some pricing calculations. (may or may not be same as what defaults on line level price level as user could change that on a per line basis)
I am trying to access the SO Sales Order header information by setting up an oSO_SOSalesOrderBus object linked to the SO_SalesOrder_Bus data source. I dont get errors when I do this, however I do not get the Customer number or any of the other data from the SO Header to pull into my variables. Is it possible to access the SO Header from the SO Details?
Thank you,
Marc
here is my code snip:
'get access to header information
'first get the sales order number of the details here
retval = oBusObj.getvalue("SalesOrderNo$",sSalesOrderNo) 'Sales order number on SO Details
oScript.DebugPrint "SalesOrder No stored in Details is " & sSalesOrderNo
sPaddedSONum = sSalesOrderNo & String(7 - Len(sSalesOrderNo),Chr(0))
oScript.DebugPrint "Padded SO Number is " & sPaddedSONum
if isObject(oSO_SOSalesOrderBUS)=false then
Set oSO_SOSalesOrderBUS = oSession.AsObject(oSession.GetObject("SO_SalesOrder_BUS"))
oScript.DebugPrint("Instantiate oSO_SOSalesOrderBUS")
end if
'now setup key value for SO Header
retVal1 = oSO_SOSalesOrderBUS.SetKeyValue("SalesOrderNo$",sPaddedSONum)
retVal2 =oSO_SOSalesOrderBUS.Find()
oScript.DebugPrint "so header find returns " & Retval2
if retval2 = 1 then 'so is found!
retVal =oSO_SOSalesOrderBUS.getvalue("CustomerNo$",sSOHCustomerNo)
retVal = oSO_SOSalesOrderBus.getvalue("BillToAddress1$",sTempVar)
oscript.debugprint "Customer number is " & sSOHCustomerNo
oScript.DebugPrint "Temp Var is " & sTempVar
END IF
'end get access to header info
------------------------------
Marc Cregan
Technology Integrators
------------------------------