Ask for approval
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
8 hours ago
Hi,
I have one requirement,
How can we configure an approval process in Flow Designer where approvals are dynamically routed to specific group members based on conditional field checks?
If a request meets specific business and IT function criteria (such as matching Engineering, CTO, CDO, or CPO with a non-IT classification), how do we target the correct group's sys_id to trigger the approval workflow?
How do we implement an "anyone approves or rejects" rule structure using group syntax so that if any member of the matched group takes action, it satisfies the approval step?
sample Script I used :var business = fd_data._1__get_catalog_variables.business_function;
var it = fd_data._1__get_catalog_variables.it_function.u_short_name || '';var approverSysId = '';
if ((business == 'a' || business == 'b' || business == 'c' ) {
approverSysId = 'dd897ef5c3b01690wrd3452dsc0131a7';
}
else if (business && business.indexOf('d) === 0 && it == 'IT') {
approverSysId = '8039beb5c3b016900193efcd2b0131f7';
}
else {
approverSysId = 'e4f93af5c3b016900193efcd2b0131a2';
}return 'ApprovesAnyU[' + approverSysId + ']OrRejectsAnyU[' + approverSysId + ']';
It is not working. what error I am doing
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
8 hours ago
Your script has a couple of syntax errors (missing ) and quotes), which will prevent it from running. Also, make sure you're returning the correct approval format and using the groupsys_id, not a user sys_id. If you're using Flow Designer, the built-in Ask for Approval action with Anyone approves/rejects is usually the better approach.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
8 hours ago
Hi @Kanimitha S
1. Depending on your criteria, use flow logic (like, an If branch or an Assign Subflow) to map the correct group's sys_id to a Flow Variable before triggering the approval
2. To ensure that only one person in the group needs to act to satisfy the approval, you need to set the Ask for Approval rule and define the approval syntax manually.
3. In your flow, add an Ask for Approval action. >For the Approvers field, >use the data pill picker to select Script. > add your logic.
Refer: Scripted Approvals in Flow Designer with Flow Variables
Flow Designer - Use "Ask for Approval" like Group Approval in Workflow
Scripted Approvals in Flow Designer with Flow Variables
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
8 hours ago
you can use scripted flow approval
Scripted Approvals in Flow Designer with Flow Variables
another better approach is to use Decision table for this
Use Decision Builder with Flow Designer to pick Approvers
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
Hi @Kanimitha S : I lead the Flow team at ServiceNow.
Scripted approvals will work, but the cleanest, low-code way to do this is what @Ankur Bawiskar mentions: using a decision table to determine the approvers via rules, then passing the result as a data pill to the Ask for Approval action.