How to set default value in Lookup button script?

Hello, 

I am scripting a button that, when clicked, opens up the sales order history lookup from the Invoice History Inquiry panel. I am trying to get this lookup to already have the sales order number entered that is shown on the current panel. 

For example if I am in AR Invoice History Inquiry looking at invoice number 55379, I want to be able to click a button that opens up the associated sales orders. My current code and picture is below. I want to click the highlighted link, and have the highlighted order number already searched for. I get the lookup panel to pop up as below, but my variable tee never populates.

retme = ""
tee = ""

retVal = oBusObj.GetValue("SalesOrderNo$", tee)
retVal = oUIObj.InvokeLookup("SO_SalesOrderHistory", retme, [tee])

Thanks, 

  • 0

    I'm not aware of any way to fill the criteria when invoking the lookup, you are probably better off launching the sale order and quote history inquiry or sales order inquiry if the order is still open task with the sales order number as the first and only argument to the UI object's Process() method which i believe you have another post for. 

  • 0 in reply to David Speck

    David is correct. Don't use InvokeLookup for this. If you want to open S/O Entry for Order 2379487, 

    For child / dependent window:

    Set oSO_UI = oSession.AsObject(oSession.GetObject("SO_SalesOrder_UI"))
    retVal = oSO_UI.Process("2379487")

    OR

    For an independent window run:

    retVal = oSession.InvokeProgram("SO_SalesOrder_UI", "2379487")