- 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-29-2018 10:58 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-29-2018 11:00 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-29-2018 04:47 PM
Did you try by adding some logs? Also confirm the group name app_SN_Role-VIP is correct.
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', 'app_SN_Role-VIP');
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-29-2018 11:01 AM
Please find the workflow above
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-12-2017 01:49 PM
you need to access variable of the catalog item and get the value of it first ,then you can check if the returned user is a member of that group.
access approvers name using current.variable_name.isMemberOf('group name');