SalesPerson data from sales order

SOLVED

Sage 100 2014

Trying to get access the sales rep details in a vbscript to write a text file with some info about the sales rep.

Looking for the correct way when launched from a Postvalidate event on the ItemCode Column:

Dim oSalesRep

Set oSalesRep = oBusObj.GetChildHandle("SalespersonNo")

Set oSalesRep = oBusObj.AsObject(oBusObj.GetChildHandle("SalespersonNo"))

Will these calls work from any tab of the Sales Order Form (eg;Lines, General etc)?

  • 0

    I believe it will only work the way you've written it when you are initiating the call from an event on the header object, not lines.  When the event is on the lines, the oBusObj refers to the line, and there is no SalesPersonNo on the line.  But it may work if you use oHeaderObj instead of oBusObj. 

    Set oSalesRep = oBusObj.AsObject(oHeaderObj.GetChildHandle("SalespersonNo")) 

    or 

    Set oSalesRep = oHeaderObj.AsObject(oHeaderObj.GetChildHandle("SalespersonNo"))  

    I think... it's worth a try!

    Hollie

  • +1 in reply to hyanaga
    verified answer

    Thanks Hollie,

    Solved as suggested, and works from lines tab

    'Get current sales order - sales rep

    Dim srEmail

    Dim srName


    set oSalesRep = oHeaderObj.AsObject(oHeaderObj.GetChildHandle("SalespersonNo"))
    retVal=oSalesRep.GetValue("EmailAddress$",srEmail)
    retVal=oSalesRep.GetValue("SalespersonName$",srName)