- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-25-2018 08:29 PM
I am trying to use a table list collector variable base if or switch condition in Service Catalog workflow , where i am checking if the options selected under list collector field contain X then move to next activity to approval stage else move to fulfilment stage. But unfortunately both If and switch activity is not working. Once X selected stil it going to fulfilment stage. Below is the workflow i am using.
Solved! Go to Solution.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-25-2018 10:31 PM
Hi Pratik,
For this you need to use the if condition with script
answer = checkValue();
function checkValue(){
var values = current.variables.<variableName>.toString();
var split = values.split(",");
var X = sysId to be searched
var arrayUtil = new ArrayUtil();
var value = arrayUtil.contains(split, X);
if(value)
return 'yes';
else
return 'no';
}
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-25-2018 10:31 PM
Hi Pratik,
For this you need to use the if condition with script
answer = checkValue();
function checkValue(){
var values = current.variables.<variableName>.toString();
var split = values.split(",");
var X = sysId to be searched
var arrayUtil = new ArrayUtil();
var value = arrayUtil.contains(split, X);
if(value)
return 'yes';
else
return 'no';
}
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-26-2018 12:30 AM
Hi Ankur,
Thank you for providing the solution, But unfortunately its not working for me, may be i am putting anything wrong in the script. Please find the below script which i am using.
answer = checkValue();
function checkValue(){
var values = current.variables.application_role.toString();
var split = values.split(",");
var X = current.varibales.application_role.sys_id;
var arrayUtil = new ArrayUtil();
var value = arrayUtil.contains(split, X);
if(value)
return 'yes';
else
return 'no';
}
Note :- The table we are using under list collector is our own company customized table , and i am unable to find the sys id for the specific record / option of the list collector, hence using "current.varibales.<varibalename>.sys_id
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-26-2018 12:47 AM
Hi Pratik,
Can you add log statements and check what values you are getting?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-26-2018 12:50 AM
Hi
I see an error in spelling .
You have written varibales.application_role.sys_id;
try with variables.application_role.sys_id;