- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2019 01:34 PM
Hello,
I am trying to figure out how to bypass the approval step in a catalog item workflow if the requester is part of the approval group. I pulled the code from the following community post:
Here is what I have:
-------------------------------------------------------
var ourUser = gs.getUser().getUserByID(current.requester);//current.requester - end user in RITM
answer = ifScript();
function ifScript()
{
if(ourUser.isMemberOf(sys-id-of-my-group))
{
return 'yes';
}
return 'no';
}
-------------------------------------------------------
This is not working for me as the workflow is not advancing to the workflow step after a Yes result.
Any ideas? I feel like this should be easier than it is so I'm assuming I'm doing this wrong.
Thanks!
Mike
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2019 01:40 PM
try adding if condition before approval activity
var person = current.request.requested_for;
var ir = new GlideRecord('sys_user_grmember');
ir.addQuery('group', 'sys-id-of-my-group');
ir.addQuery('user', person);
ir.query();
if(ir.next()){
answer = 'yes';
}else{
answer = 'no';
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2019 10:11 AM
updated.