Want to skip approval if requested by is same as approver
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2022 07:16 AM
I have one group approval on RITM after request submit in that group there are two persons for approval 'A' and 'B' .My requirement is when the request is submitted by 'A' want to skip approval.
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2022 08:50 AM
You might wanna add If condition activity before your approval activity
1. Check Advanced = True
2. Add script:
answer = ifScript();
function ifScript() {
var reqFor = current.variables.requested_for ; // replace with your value for requester for.
var approvalUser = new GlideRecord("sys_user_grmember"):
approvalUser.addQuery("group","sys_id of your Approval GROUP");
approvalUser.query();
while(approvalUser.next()){
if(approvalUser.getValue("user") == reqFor){
return 'yes';
}
return 'no';
}
Let me know if this works, feel free to drop Thumbs up 🙂
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2022 09:07 AM
You have to use the "Approval user" activity in workflow. Check the advance option to true and use the below script.
It will skip the approval for user A/ B, if he/she is request opened by user.
answer = [];
var approvers = new GlideRecord('sys_user_grmember');
approvers.addEncodedQuery('approval_group_sys_id');
approvers.query();
while(approvers.next()) {
if(approvers.user.toString() != current.request.opened_by.toString()) {
answer.push(approvers.user.toString());
}
}
Regards,
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2023 04:26 AM