FLow designer Approval
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
//we want to send approval to group manager and manager's manager . how to achieve this using flow designer ask for approva;
(function() { var approvers = ''; var grp = new GlideRecord('sys_user_group'); if (grp.get('90dd4dc3db731200fed3b33fdf961917')) { var mgr = grp.getValue('manager'); if (mgr) { approvers = mgr; var usr = new GlideRecord('sys_user'); if (usr.get(mgr)) { var mgr2 = usr.getValue('manager'); if (mgr2) approvers += ',' + mgr2; } } } return 'ApprovesAll[' + approvers + ']RejectsAny[' + approvers + ']'; })();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
55m ago
Hi,
You are very close, but the syntax ApprovesAll[...] is used for legacy Workflows. Flow Designer expects the script to return a simple Array of SysIDs.
Here is how to implement this correctly in Flow Designer:
Step 1: Configure the 'Ask for Approval' Action
Add the Ask for Approval action.
Set the Record (e.g., Trigger record).
Under Rules, select "Approve or Reject".
In the rule configuration, locate the Approvers field.
Click the Script icon (f/x) next to the field to open the script editor.
Step 2: Use this Updated Script Paste this code. I have updated it to return the correct Array format required by Flow Designer.
/* ** Access Flow data using 'fd_data' ** Example: var short_desc = fd_data.trigger.current.short_description; ** return ["sys_id_1", "sys_id_2"]; */ (function() { var approverList = []; // Initialize an array var groupID = '90dd4dc3db731200fed3b33fdf961917'; // Your Group ID var grp = new GlideRecord('sys_user_group'); if (grp.get(groupID)) { // 1. Get Group Manager var mgr = grp.getValue('manager'); if (mgr) { approverList.push(mgr.toString()); // Add Manager to array // 2. Get Manager's Manager var usr = new GlideRecord('sys_user'); if (usr.get(mgr)) { var mgr2 = usr.getValue('manager'); if (mgr2) { approverList.push(mgr2.toString()); // Add Manager's Manager } } } } // Flow Designer expects an Array of IDs return approverList; })();
Why this changes:
Legacy Workflow: Uses strings like ApprovesAll[id].
Flow Designer: Uses Arrays like [id1, id2].
If this response helps you solve the issue, please mark it as Accepted Solution.
Best regards,
Brandão.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
25m ago
Thanks for the reply Itallo , this is not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
53m ago
Hello @Rajeevreddy
You could use Ask for Approval action in flow and can dot walt using data pills to get manager's manager.
Like , Trigger -> Assignment group -> Manager -> Manager.
Kind Regards,
Sankalp
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
26m ago
How do we do like assignment group we are not taking from ritm .
