AntoineS Contributor.
Contributor.
183 views

Retrieve GlobalList Labels in a Workflow

Jump to solution

Hello,

Does anyone know if there is a way to retrieve the global list labels in the workflow context?

I could only find IDVault.globalList(key) that returns an Array of global list values, but no labels.

Labels (2)
Tags (2)
0 Likes
1 Solution

Accepted Solutions
FT Trusted Contributor.
Trusted Contributor.

Re: Retrieve GlobalList Labels in a Workflow

Jump to solution

The code I've been using was:

...
cListByName = IDVault.globalQuery(null, "CFilterByName", {"firstName":form.getValue("fcon_name")});
...
if (cListByName[0].length>0){
    ...
}
...

In most cases results received from portal interface APIs are stored in object containing two arrays: [0] for keys and [1] for display values. This applies to global lists too.

Notice I wasn't pushing these values through any field, cause getValues() on the other hand will return only keys. This is what description says:

clipboard_image_0.png

The code for you to get specific description would be

IDVault.globalList(null, "listKey")[1][indexOfWhateverElementFromList]

 and don't forget about locales. 😉

View solution in original post

3 Replies
FT Trusted Contributor.
Trusted Contributor.

Re: Retrieve GlobalList Labels in a Workflow

Jump to solution

I believe you have to play a bit with the returned object. AFAIR it is a array of arrays and to get to proper list you need to use result[0] to get keys or result[1] to get the labels. Not specifying index gives you the first, as you have noticed.

0 Likes
AntoineS Contributor.
Contributor.

Re: Retrieve GlobalList Labels in a Workflow

Jump to solution
Thank you for your answer.

I tried the field.getValues() function with all the syntaxes I could think of ( 0, "0",[1],"[1]").
It turns out that in any case it always returns me the value (key) of the selected GlobalList field.
Is that the function you're talking about ?
0 Likes
FT Trusted Contributor.
Trusted Contributor.

Re: Retrieve GlobalList Labels in a Workflow

Jump to solution

The code I've been using was:

...
cListByName = IDVault.globalQuery(null, "CFilterByName", {"firstName":form.getValue("fcon_name")});
...
if (cListByName[0].length>0){
    ...
}
...

In most cases results received from portal interface APIs are stored in object containing two arrays: [0] for keys and [1] for display values. This applies to global lists too.

Notice I wasn't pushing these values through any field, cause getValues() on the other hand will return only keys. This is what description says:

clipboard_image_0.png

The code for you to get specific description would be

IDVault.globalList(null, "listKey")[1][indexOfWhateverElementFromList]

 and don't forget about locales. 😉

View solution in original post

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.