Invoke BT_CustomerNo in PostValidate script

SOLVED

SO Entry, Header column post validate script on CustomerNo.  The script checks a couple things, and under certain circumstances I want to open the selected customer record using Customer Maintenance (so the user can type in a new email address).

The problem I am running into is that the CustomerNo is not yet set, so invoking the UI button doesn't have the correct value yet.

Customer Maintenance then opens, but without the customer selected.  The CustomerNo is absolutely available in the script because I can update a customer UDF (under different scripted circumstances) but the value is somehow unavailable for the oScript.InvokeButton("BT_CustomerNo")

How do I open Customer Maintenance, with the correct customer selected, from a column post validate script on CustomerNo?  I tried adding oUIObj.HandleScriptUI() but it just gave me errors.

(Premium v2018, if it matters).

  • 0

    Are you including the division.

  • +1
    verified answer

    It's a timing issue where CustomerNo validation has not finished yet and is still setting the value. The hyperlink button runs independently and doesn't have the CustomerNo yet. You are better off doing this:

    'This will pop open an independent Customer Maintenance window.
    retVal = oSession.InvokeProgram("AR_Customer_ui", tmpDiv & tmpCust)

    'Probably even better to pop a dependent window and this is how but you can't
    'pass more than 1 key part to the .Process() method. It would've worked for say Item Maint.
    If IsObject(oUIObj) = False Then
      oUIObj = oScript.UIObj
      Set oUIObj = oSession.AsObject(oUIObj)
    End If
    retVal = oUIObj.Process(tmpDiv  & tmpCust)

  • 0 in reply to Alnoor

    Thanks a ton Alnoor.  I knew I'd need to do something like that but wasn't sure of the exact command to open the new window.  In this case opening an independent window is not a big deal.  (The script prompts the user to confirm the customer email address is still OK... and allows them to easily confirm or update).

    It's a bit odd, with the same script logic also running in AR_Customer, but it works!

  • 0

    Thank you for posting something like this. . . .Tellpizzahut