In the flow design, how to exclude one person from approving the request?

2022_ServiceNow
Tera Expert

Hi,

 

I have a requirement where, in the flow design, in the "ask for approval", I've added a group for approval process, but I need to exclude one person from approving the request who is the part of that group.

How can I achieve it?

 

Thanks in advance!

4 REPLIES 4

Community Alums
Not applicable

Hi @2022_ServiceNow ,

In Ask for Approval action, you have field called "Rules" where you can setup below:

Define the approval and rejection rules. Approval rules determine which users can approve or reject requests, and what happens after approval or rejection. Approval or rejection rules include:

  • Anyone approves
  • All users approve
  • All responded and anyone approves
  • % of users approve
  • # of users approve

In the field beside the approval rule, add the desired approvers. To add approvers:

  • Select individual users or groups.
  • Drag or select a field from a record.
  • Select 
     
     to allow a manual approver to process an approval or rejection. A manual approver is a user manually added to the Approvers related list who can then approve the request. For example, you can manually add a subject matter expert to a task to approve the request. To learn more about adding manual approvers, see Generate approvals using the approvers related list.

Define rejection rules by adding another OR rule set. When defining approvals, include rejection rules that run when there are no matching approvals. Such rejection rules prevent the flow from remaining in a waiting state. For example, if an approval can be approved by anyone, create a time-based rejection rule in case no one approves it.

Note: If you set an approval rule with no rejection rule (or vice versa) and the expected approval state is not met, the runtime value will be canceled.

Hi, 

Thank you for your response.

I have already added the rule and have mentioned a group for approval with approve or reject when anyone approves or rejects. But, from the group that I've mentioned for approval, I do not want to approve or reject the request from one particular person who is the part of that group. How do I exclude that one person?

@2022_ServiceNow , did you ever get a response to this? I have a  similar requirement and need to achieve the same results. I still need group to approve, but need to exclude a member of that approval group if they are the opened_by or the requested_for manager.

 

Simple way to solve this without mucking around with scripting in Flow Designer Approvals.

 

Call your group approval as normal from your flow.

Add a simple BEFORE INSERT BR on the Approval Table with a filter of Approval For.Task Type = Change Request  (You can fine tune this further if needed with State and/or Change Type)

--- BR Code --

(function executeRule(current, previous /*null when async*/) {

var chg = current.sysapproval;  // Ref to the change being approved
var user = current.approver; // Ref to the user about to get an approval record
var gr = new GlideRecord('change_request');
gr.addQuery('sys_id',chg);
gr.query();
if (gr.next()){
    if (gr.requested_by == user){ // Compare user references and abort if they match
        current.setAbortAction(true);
    }  
}

})(current, previous);
----
Doubtless there is a more elegant way to write the script, but fewer lines tends to mask functionality when coming along later to troubleshoot, so definitely add comments.