- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2020 12:33 AM
Hi team,
i have requirement like in the workflow i have multiple fields like reference and select box variables .
for example if the field is ABC has values (yes and no). and another field DEF has values (yes and no) and 1 more field XYZ has values (none,include and exclude) .
if the ABC value is yes and DEF value No and XYZ value is None based on this condition i want to trigger a approval in workflow for requestor manager.
otherwise ABC value is No and DEF value YES and XYZ value is include based on this condition i want to trigger a approval for Particular group.
can anyone help me with the script.
Regards,
Chinna
Solved! Go to Solution.
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2020 12:43 AM
you can use here if activity in your workflow. you will add it before the approval activity
now in if activity you will check the above condition and then return your transition to further step.
eg:
answer = ifScript();
function ifScript() {
var cNum = current.variales.<variale name abc>;
var cNum1 = current.variales.<variale name def>;
var cNum2 = current.variales.<variale name xyz>;
if (cNum == 'yes' && cNum1 =='No' && cNum2 == 'None') {
return 'yes';
}
else{
return 'no';
}
}
after if activity you will add user approval and group approval activity.
you will take if activity transition yes to user approval and no to group approval activity.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2020 01:24 AM
Edit:
I think switch activity will not work here, because you have not one specific variable.
using if activity it can be done. i am sorry for this confusion.
kindly have a look on below blow to add more condition . it will help you.
https://community.servicenow.com/community?id=community_blog&sys_id=d1fde22ddbd0dbc01dcaf3231f961912
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2020 04:22 AM
Thanks harshavardhan, its very helpful.