Respected Contributor.. nasu Respected Contributor..
Respected Contributor..
163 views

Problem finding a customization list

Jump to solution

I would like to add an item to a customization list from workflow script. I have simplified my code below, still being able to reproduce my problem.   

Sub AddItemToList(strListName)

  On Error Resume Next

  Dim objCust
  Set objCust = TDConnection.Customization
  objCust.Load

  Dim objList
  Set objList = objCust.Lists.List("MyList")     ' Works
'Set objList = objCust.Lists.List(strListName) ' Does not work If Err.NUmber <> 0 Then msgbox "Error: " & Err.Description Dim objRootNode
Set objRootNode = objList.RootNode objRootNode.AddChild("Create STM32 Hotfix Branch") On Error GoTo 0 End Sub

If I try to find the list using the list name passed as a parameter I get an "Invalid procedure call or argument" error but if I hardcode the list name, everything is fine. I have of course checked that the passed list name is correct. 

Any ideas?

0 Likes
1 Solution

Accepted Solutions
Highlighted
Knowledge Partner Knowledge Partner
Knowledge Partner

Re: Problem finding a customization list

Jump to solution

Sometimes when passing string parameters in the OTA you may run into problems like this. I never found out exactly why and when, but chances are good it will work if you explicitly convert the variable to string. Try:

Set objList = objCust.Lists.List(CStr(strListName))
Jan Czajkowski

[Please do not contact me off line for receiving support. Use the forum!]
1 Reply
Highlighted
Knowledge Partner Knowledge Partner
Knowledge Partner

Re: Problem finding a customization list

Jump to solution

Sometimes when passing string parameters in the OTA you may run into problems like this. I never found out exactly why and when, but chances are good it will work if you explicitly convert the variable to string. Try:

Set objList = objCust.Lists.List(CStr(strListName))
Jan Czajkowski

[Please do not contact me off line for receiving support. Use the forum!]
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.