Using a switch statement to evaluate multiple true/false variables

KristyS
Kilo Guru

I have a form that has 5 checkbox variables and a requester can select all 5 checkboxes.  

Is there a way to build a switch activity to evaluate these checkboxes instead of creating 5 if statements?  Trying to simply this workflow as much as possible. 

 

find_real_file.png

5 REPLIES 5

Michael Ritchie
ServiceNow Employee
ServiceNow Employee

Switch activities expect 1 result and in your case you can have multiple since these are checkboxes that can be checked independently.  You can certainly script this with a single run script that evaluates the checkbox and creates a task but you lose the visual view of it.  If you need to wait for all the tasks to complete prior to a subsequent activity that is more difficult scripting the tasks as well.

 

Unfortunately your nested Ifs is really the easiest way to accomplish what you are after via workflow.

Community Alums
Not applicable

Check out this article:

Workflows - Playing With the If Activity

This is an example of how to use an If statement to evaluate the input and allow for multiple outputs activities.

 

Tim

Nice find.  This should work for the OP use case.

Community Alums
Not applicable

Hello @Community Alums 

Is there any chance you could provide an updated link?