- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-05-2014 10:32 AM
Scripting is still a very new to me.... that being said does anyone have scripting (or a different way) to prevent the requester of a change request form from being included in the list of approvers. On occasion the requester of a change request is also in the approving group and we don't want their name to come up in the list in the this case.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-05-2014 02:09 PM
In the activity properties you will need to remove the "IT Infrastructure Managers" group from the groups field and instead script the members. You click on the "Advanced" field and then a script section will show up. The following script will add anyone within this group to the approvers list unless they are the requested_by user.
answer = [];
var approvers = new GlideRecord('sys_user_grmember');
approvers.addQuery('group.name', 'IT Infrastructure Managers');
approvers.query();
while(approvers.next()) {
if(approvers.user.toString() != current.requested_by.toString()) {
answer.push(approvers.user.toString());
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-05-2014 11:00 AM
I'm guessing you are using Workflow approval-user activity:
The code will be something like this:
//get all the approvals from a Glide
while(gr.next() && gr.sys_id != current.requested_by)){
answer.push(gr.sys_id)
}
Also, do let me know what you are using in your workflow.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-05-2014 01:50 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-05-2014 01:55 PM
In this case what I'd do is add an IF workflow activity just before your approval activity. Then build a little script (like shown before) to check if they are the same person. If they are, simply go to the next step in the workflow. If they are different, lead into the approval activity you're showing above.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-05-2014 02:09 PM
In the activity properties you will need to remove the "IT Infrastructure Managers" group from the groups field and instead script the members. You click on the "Advanced" field and then a script section will show up. The following script will add anyone within this group to the approvers list unless they are the requested_by user.
answer = [];
var approvers = new GlideRecord('sys_user_grmember');
approvers.addQuery('group.name', 'IT Infrastructure Managers');
approvers.query();
while(approvers.next()) {
if(approvers.user.toString() != current.requested_by.toString()) {
answer.push(approvers.user.toString());
}
}