- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2017 07:31 AM
Hi guys,
when using a variable like a "Select Box" I can retrieve with a SWITCH into a workflow all the choices available...
But while using this SWITCH function with a Yes / No variable type, it does not list automatically Yes, No as possibilities... Do you know why ?
Do I need to add a condition by right clicking on the swith and putting a condition called "yes" and another one "no" ?
OR should I need to create select box with Yes & No as choices ?
thanks a lot !
Solved! Go to Solution.
- Labels:
-
Workflow

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2017 09:57 AM
Can you please try with below script.
answer = ifScript();
function ifScript(){
if(current.variables.Corefa_UCM_BudgetOwner == 'Yes')
return 'yes' ;
return 'no';
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2017 07:32 AM
if you only has yes & no, why not just use the if-statement activity?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2017 07:35 AM
Sure but then I need to put a script into the "IF" activity ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2017 08:11 AM
Hi Thomas,
Yes you will need to have script in if activity
answer = ifScript();
function ifScript(){
if(current.variables.<variable_name> == 'yes')
return 'yes' ;
return 'no' ;
}
Instead you can use switch condition easily: just select the variable and select the path it should follow based on variable value
Mark Correct if this solves your issue and also hit Like and 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
08-05-2017 08:56 AM