- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2014 05:49 AM
Hi everyone -
I need to check for a particular selection from a list collector in a Service Catalog item. In the workflow, I can get the values (which are comma delimited by default) like:
current.variables.list_collector.getDisplayValue()
What I need to do is when generating tasks, I need to create a task if a certain item is in the list collector. In the workflow, how can I parse the selections and look for a particular item?
Thanks,
Shane
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2014 06:21 AM
Hi,
Not tested, but in an "if" activity, you can try something like (or remove the toString):
var arrayUtil = new ArrayUtil();
var list = current.variables.list_collector.getDisplayValue().toSring();
var arrayList = list.split(",");
if (arrayUtil.contains(arrayList, "youritem")) {
answer="yes";
} else {
answer="no";
}
Best Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2014 06:24 AM
Hi Shane,
You can try using this:-
var liststr = current.variables.list_collector.toString();
var listarray = liststr.split(',');
for(index=0; index<listarray.length; index++)
{
//You Validation Code on listarray[index]
}
Thanks,
Subhajit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2014 06:58 AM
I have tried the following:
var liststr = current.variables.list_collector.toString();
var listarray = liststr.split(',');
for(index=0; index<listarray.length; index++)
{
if ((listarray[index] == "Item A") || (listarray[index] == "Item B")) {
answer="yes";
}
else {
answer="no";
}
}
I am selecting Item A as one of the selections in the list collector, but the code is returning result No...