- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2019 08:14 PM
Hi all,
I have a requirement, where on a catalog end user submission form we have two fields 'caller' and 'group' fields which has to be filled by the user.
Now the requirement is in the work flow we need to check if the user in the caller is part of the group value in the variables. If the user is part of that group we need to trigger approvals in the workflow, other wise skip the approval.
Please suggest. Thanks in advance.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2019 09:12 PM
Hi Kishan
Use if activity and below script; the yes output would go to approval activity; the no output would go to the activity which is next to approval in workflow
Ensure you use proper user and group variable in below script
answer = ifScript();
function ifScript(){
var userObject = gs.getUser().getUserByID(current.variables.userVariable);
if(userObject.isMemberOf(current.variables.groupVariable))
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2019 10:31 PM
Hi Kishan,
Any update on this?
Can you mark the answer as Correct, Helpful if you were able to achieve the requirement & then close the thread.
Thanks in advance.
Regards,
Sanket