- 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-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-14-2019 11:57 AM
Hi Mike!
Thanks for the quick reply! I tried this and it didn't work but I think I figured it out.
I changed:
var person = current.request_requested_for;
To:
var person = current.request.requested_for;
And it worked! Thanks so much!
Mike

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-14-2019 12:19 PM
Yes, I meant to add . and added _ by mistake. Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-30-2019 10:09 AM
Are still able to edit that post? If you can fix the typo I can set it to "Mark as Correct Answer". Thanks again!