Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

list collector variable base if or switch condition in workflow not working.

pratikyadav
Tera Contributor

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.

 

find_real_file.png

find_real_file.png

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

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

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

5 REPLIES 5

Hi Pratik,

Can you please mark answer as correct, helpful if this is achieved?

Regards

Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader