Flow Designer: Exclude 'Opened by' from group apprval

ramkumarjai
Tera Contributor

Hi Team, 

 

Is it possible to exclude one specific member from an approver request when using the Ask for Approval action in Flow designer?

For example:

We have a group called ABC with five members. If the opened by member is also part of this group, the approval request should only be sent to the remaining  members, excluding the Opened by member.

Is this feasible in Flow Designer Ask for Approval action?

 

Thanks in advance!

 

4 REPLIES 4

OlaN
Giga Sage
Giga Sage

Hi,

No, not directly.

In this case you will need to implement some check in the flow, to evaluate if the opened by is the member of the approval group, and then procede with different approval actions depending on the outcome of the evaluation.
One action that sends to the group if the user is not a member.

Another action that gets the usersfrom the group and excludes the opened by from the approvers.

tejas1111
Tera Contributor

Yes — it’s absolutely possible to exclude a specific member (like the Opened by user) from a group approval in Flow Designer, but you can’t do it directly using the standard Ask for Approval action.
Instead, you need to filter the approvers list first and then pass that filtered list to the Ask for Approval step.

Here’s how you can do it:

First, use a Look Up Records action in Flow Designer to fetch all members of your group (sys_user_grmember table).
For example, filter the lookup so that Group equals your target group (ABC), and retrieve the associated users.
This step will return all members of the group, including the Opened by user if they belong to the group.

Next, add a Run Script action in Flow Designer to filter out the unwanted user from this list.
In this script, you’ll loop through the returned group members and remove the Opened by user’s Sys ID from the array before sending it to the approval step.
Here’s an example of the script you can use:

 

(function execute(inputs, outputs) {
    var filteredList = [];
    var openedBySysId = inputs.openedBy; // Sys ID of the 'Opened by' user
    
    var members = inputs.groupMembers; // GlideRecord list from Look Up Records
    while (members.next()) {
        if (members.user.toString() !== openedBySysId) {
            filteredList.push(members.user.toString());
        }
    }
    
    // Create a comma-separated string of approver sys_ids
    outputs.approverList = filteredList.join(',');
})(inputs, outputs);

Finally, in the Ask for Approval action, instead of selecting the group directly, use the output from the script step (outputs.approverList) as the list of approvers.
This ensures the approval request will be sent to all members of the group except the one you excluded (in this case, the Opened by user).

Ankur Bawiskar
Tera Patron
Tera Patron

@ramkumarjai 

Yes possible with OOTB Ask for Approval flow action but using script.

You can use scripted flow approval, get the members and exclude opened by user if he/she is group member

Scripted Approvals in Flow Designer with Flow Variables 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@ramkumarjai 

Hope you are doing good.

Did my reply answer your question?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader