Object doesn't support this property or method error message oUI.Process

SUGGESTED

I have a script that errors out on an intermittent basis. I was wondering if anyone has any ideas on why.  I can go days without getting an error message, then once I get the error I have to exit out of sales order entry.  Once I return to SO entry I no longer get the error when I select the button. 

 

Running Sage 100 2014

Advanced

Multiple locations using Sage 100 SO Data Entry

 

Error message:

Error 438

Object doesn’t support this property or method: “oUI.Process”

 

 

In Sales Order Entry

On the lines tab

Select an inventory item

Select the Link button – this launches the script – the script will launch item inquiry for the item selected - this button is selected on almost every order.

 

Dim sItemCode

 

sItemCode = ""

 

If Not(IsObject(oLines)) Then

                Set oLines = oBusObj.AsObject(oBusObj.Lines)

End If

 

retVal = oLines.GetValue("ItemCode$",sItemCode)

 

If Not(IsObject(oUI)) Then

                Set oUI = oSession.AsObject(oSession.GetObject("IM_ItemInquiry_ui"))

End If

 

'retVal = oSession.InvokeProgram("IM_ITEM_UI", sItemCode)

retVal = oUI.Process(sItemCode)

 

Thank you for your time.

Parents
  • 0
    SUGGESTED

    One idea that comes to mind is that you're not dropping your object handle to IM_ItemInquiry_ui at the end of your script.

    If i remember correctly, each time they click that button, it's is getting a new handle.

    One way around this is to store the numeric object handle from GetObject to a variable in your script and then store it in the current bus object's script object or the session's script object using the SetStorageVar method, at the beginning of your script, use whichever script object you choose and use the GetStorageVar method, check if the value is 0, if it is, then this is the first time the button has been clicked and you will need to get the numeric handle and then use the SetStorageVar method so it can be retrieved on future clicks, if not, then use the session AsObject method passing the numeric handle variable you retrieved and "set" it as a vbscript object.

    The other way you can do this is real clean and simple. Set the button script to run on the server and put the following in the script file,

    Set oLines = oSession.AsObject(oBusObj.Lines)
    sItemType = ""
    retval = oLines.GetValue("ItemType$", sItemType)
    If sItemType = "1" Then
        oUIObj.DRBT_ItemInquiry()
    Else
        sretval = oSession.AsObject(oSession.UI).MessageBox("", "Select a valid item to launch Item Inquiry.", "icon=I")
    End If
    Set oLines = Nothing

    Add your desired shortcut key (Hot Key) to your button and you should be good to go.

Reply
  • 0
    SUGGESTED

    One idea that comes to mind is that you're not dropping your object handle to IM_ItemInquiry_ui at the end of your script.

    If i remember correctly, each time they click that button, it's is getting a new handle.

    One way around this is to store the numeric object handle from GetObject to a variable in your script and then store it in the current bus object's script object or the session's script object using the SetStorageVar method, at the beginning of your script, use whichever script object you choose and use the GetStorageVar method, check if the value is 0, if it is, then this is the first time the button has been clicked and you will need to get the numeric handle and then use the SetStorageVar method so it can be retrieved on future clicks, if not, then use the session AsObject method passing the numeric handle variable you retrieved and "set" it as a vbscript object.

    The other way you can do this is real clean and simple. Set the button script to run on the server and put the following in the script file,

    Set oLines = oSession.AsObject(oBusObj.Lines)
    sItemType = ""
    retval = oLines.GetValue("ItemType$", sItemType)
    If sItemType = "1" Then
        oUIObj.DRBT_ItemInquiry()
    Else
        sretval = oSession.AsObject(oSession.UI).MessageBox("", "Select a valid item to launch Item Inquiry.", "icon=I")
    End If
    Set oLines = Nothing

    Add your desired shortcut key (Hot Key) to your button and you should be good to go.

Children
No Data