The CreatorCon Call for Content is officially open! Get started here.

list collector not working in If condition activity in workflow

siddharth26
Tera Guru

Hi All,

 

I have a requirement in service catalog wherein there is one field 'environment'  this is a list collector  which has 3 options Prod, Pre prod and  prod&preprod , so when the user selects only prod one task should get created , when user selects only pre prod one task should get created , but when user selects 3rd option prod&pre-prod then 2 task should get created.

 

I have achieved this by changing the field type as 'Select Box' but when i am changing to list collector is it not working.

 

i have tried the if activity and switch activity both are not working when the field type is list collector and its working when the field type is select box but i need this to work with list collector.

I have to use here only workflow.

 

Please find the snip of the wf for your ref.

siddharth26_0-1690998974407.png

if condition as below:

 

siddharth26_1-1690999022362.png

thanks

 

4 REPLIES 4

Ravi Chandra_K
Kilo Patron
Kilo Patron

Hello @siddharth26 

Try changing to contains and check if it us working.

Please mark the answer as correct solution and helpful if helped.

 

Kind Regards,

Ravi chandra

Hi Ravi,

I have changed to contains still its not working

 

thanks

Hello @siddharth26 

Use if Condiion with Script.

refer:

answer = ifScript();

function ifScript(){

var env = current.variables.environment.toString();

if(env.indexOf('sys_ids of values') != -1)

    return 'yes';

else

    return 'no';

}

https://www.servicenow.com/community/itsm-forum/list-collector-variable-base-if-or-switch-condition-...

https://www.servicenow.com/community/now-platform-forum/workflow-conditions-based-on-list-collector-...

Please mark the answer as correct solution and helpful if helped.

 

Kind Regards,

Ravichandra 

Ravi Chandra_K
Kilo Patron
Kilo Patron

Hello @siddharth26 

Greetings!

Any feedback on my reply? 

Please mark the answer as correct solution and helpful if helped.

 

Kind Regards,

Ravi Chandra