Questions on InvokeLookup

SOLVED

Hello,

I have create a UDF called Item code in Cash Receipt detail table and add it on the Grid. I want to create a Button script using the invokelookup which will fire off the item code list and can select the item code from the list, then set the selected value to my UDF.

I was able to make the invokelookup working, but I was failed on set the value to the UDF.

Here is my script, (which is a button script):

retVal = 0
LookupCode = "CI_ItemCommon"
ItemCode = ""
retLookup = oUIObj.InvokeLookup(LookupCode, ItemCode)

If retVal <> 0 and ItemCode <> "" then
retVal = oBusObj.SetValue("USF_MISCITEM$", ItemCode)
End If

Can anyone help me on Set the value to my UDF? (the UDF is also on the grid)

 

Thanks

Michelle

Parents
  • 0
    Hi Michelle,

    In your script above the variable for your UDF has a typo. Should be UDF not USF

    retVal = oBusObj.SetValue("USF_MISCITEM$", ItemCode) ' should be "UDF_MISCITEM$"

    If that's not the case in your real script what is the value of the returning value? (retVal) If this is zero (0) you can also check the value of oBusObj.LastErrorMsg which should give you some idea of why the setting of the variable is failing.

    Hope this helps
    Elliott
  • 0 in reply to jepritch
    Hello Elliott,

    Thanks for Pointing out the "UDF" typo. I have tried the "oBusObj.LastErrorMsg" and get the message of " The column is not in IOlist". I have tried the "o'activate("X/X","XXX")" code which I have searched online, but does not really work. Do you know anything about this? Can you give me any hint?

    Thanks
    Michelle
  • 0 in reply to Michelle Li
    verified answer

    Hi Michelle,

    I think the problem is that because this button thinks that the business object it is dealing with is the header object, however, you may not want to use SetValue() in this case anyway since your field is in the grid.  You can use InvokeChange() which emulates the user actually typing in the value.  This is preferred so that normal grid actions take place such as advancing to the next cell etc.  You probably want to change the script slightly to the following

    retVal = 0
    LookupCode = "CI_ItemCommon"
    ItemCode = ""
    retLookup = oUIObj.InvokeLookup(LookupCode, ItemCode)

    If retVal <> 0 and ItemCode <> "" then

    retVal = oUIObj.InvokeChange("UDF_MiscItem$", itemCode, "GD_LINES")

    End If

    Hope this helps.

    Elliott

Reply
  • 0 in reply to Michelle Li
    verified answer

    Hi Michelle,

    I think the problem is that because this button thinks that the business object it is dealing with is the header object, however, you may not want to use SetValue() in this case anyway since your field is in the grid.  You can use InvokeChange() which emulates the user actually typing in the value.  This is preferred so that normal grid actions take place such as advancing to the next cell etc.  You probably want to change the script slightly to the following

    retVal = 0
    LookupCode = "CI_ItemCommon"
    ItemCode = ""
    retLookup = oUIObj.InvokeLookup(LookupCode, ItemCode)

    If retVal <> 0 and ItemCode <> "" then

    retVal = oUIObj.InvokeChange("UDF_MiscItem$", itemCode, "GD_LINES")

    End If

    Hope this helps.

    Elliott

Children