- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-12-2017 01:35 PM
Hello, In the catalog workflow I am trying to add a "check" (if statement) in our hardware and software workflow in which users in a certain group are pre-approved and skip the approval piece in the workflow. Here is what I have so far:
(I am not a developer so if this code is incorrect please let me know)
answer = preapprovalcheck();
function preapprovalcheck(){
var userCheck;
if(userCheck.isMemberOf('SN-ApprovedEAs')){
answer = true;
} else {
answer = false;
}
}
Here is the workflow:
Solved! Go to Solution.
- Labels:
-
Customer Service Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-23-2017 07:24 PM
Lets add some debugging. Let me know, what you see in system log after running the below script.
answer=preapprovalcheck();
function preapprovalcheck(){
gs.log('++++++++++++++++++current.requested_for is '+current.requested_for);
var grMem = new GlideRecord('sys_user_grmember');
grMem.addQuery('user', current.requested_for);
grMem.addQuery('group.name', 'SN-ApprovedEAs ');
grMem.query();
if(grMem.next()){
return 'yes';
gs.log('++++++++++++++++In Yes++++++++++++++++++++');
} else {
gs.log('++++++++++++++++In No++++++++++++++++++++');
return 'no';
}
Please mark this response as correct or helpful if it assisted you with your question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-23-2017 07:24 PM
Lets add some debugging. Let me know, what you see in system log after running the below script.
answer=preapprovalcheck();
function preapprovalcheck(){
gs.log('++++++++++++++++++current.requested_for is '+current.requested_for);
var grMem = new GlideRecord('sys_user_grmember');
grMem.addQuery('user', current.requested_for);
grMem.addQuery('group.name', 'SN-ApprovedEAs ');
grMem.query();
if(grMem.next()){
return 'yes';
gs.log('++++++++++++++++In Yes++++++++++++++++++++');
} else {
gs.log('++++++++++++++++In No++++++++++++++++++++');
return 'no';
}
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-05-2017 05:26 PM
For some reason this same script started working for me. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-25-2018 08:52 AM
I have used your script which you have mentioned but didn't work. Basically, I have one workflow where I'm checking whether requested user is belongs to VIP group or not. If that user from VIP group then workflow should skip all the approvals and should go directly to Fulfillment stage. How can I do this?
answer = preapprovalcheck();
function preapprovalcheck()
{
var grMem = new GlideRecord('sys_user_grmember');
grMem.addQuery('user', current.requested_for);
grMem.addQuery('group.name', 'app_SN_Role-VIP');
grMem.query();
if(grMem.next()){
return 'yes';
} else {
return 'no';
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-29-2018 09:16 AM
Can you post the complete workflow?
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-29-2018 10:57 AM