One person from each group should Approve in Flow Designer

swaroop
Kilo Sage

Hello All,

 

Advice required on this Requirement - There is a parallel Approval in Flow Designer, from that One person from each group should Approve as well if one person is Approved then Automatically for remaining persons from the same Group should become 'No Longer Required'.

I have tried by Empty the Approval Field on the Ask for Approval actions, so that no record watcher is being created for those approvals, but it is making all Approvers from each group to Approve.

Can any one please suggest me how to achieve this.

 

Thanks,

S.Swaroop.

6 REPLIES 6

AJ M
Mega Sage

I have created a subflow because we have multiple scenarios like this in our catalog.

 

Inputs: 

  • Requested Item is a Reference field to the Requested Item we're approving
  • Groups is a List.Group

Outputs:

  • Approval Status - I'm simply setting this to the Ask for Approval's Approval State

 

The most important part is the Ask for Approval. The "Rules" are scripted as such:

 

var group_list = fd_data.subflow_inputs.groups.getEncodedQuery().slice(8);
return "ApprovesAnyG[" + group_list.replaceAll(",", "]&AnyG[") + "]OrRejectsAnyG[" + group_list + "]";

 

 

AnitaJ_0-1733529265398.pngAnitaJ_1-1733529275917.png

georgematau
Tera Contributor

This can be done using FlowDesigner approval rules in both drag-and-drop and scripted format

 

Drag and drop should look something like this. The two groups have to be added separately with AND between them translating to 'Anyone from each group'. If the groups are added instead in the same box, then this would translate to ''Anyone from all groups'.

Screenshot 2025-02-17 at 15.20.46.png

 

Using scripted approvals the code should be like this 

 

AnyG['group1_sysid']&AnyG['group2_sysid']

 

 
In older instances I found out that this doesn't work until I set the system property 'com.glide.hub.flow.approval.function.early_terminate' to false, as suggested by this article from NowSupport https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB1504056