Flow Designer action "Ask For Approval" -- send approval req to manager of group?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
I am familiar with building flows that send approvals to groups. However, I have a request from a customer to send an approval to the manager of a group.
I'm not seeing anything in the Flow Designer GUI that would do this, and my queries to co-workers, AIs, and the internet haven't yielded a clear answer.
Is anyone aware of a way to do this in Flow Designer without scripting it?
If scripting is the only answer, would anyone be able to help get me started with a script that would do this? I'd like to specify the group and have the approval go to the manager (sys_user_group.manager).
Thanks!
CSA, Senior Enterprise Application Analyst
ServiceNow DevOps
Children’s Health System of Texas
Dallas, Texas, USA
- Labels:
-
Flow Designer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
Hi @David Hepburn ,
We can create a custom flow action. If you input the group sys id or name as an output it can give the manager sysid of the group. here is the script you can add it in your custom action;
(function execute(inputs, outputs) {
// inputs.groupSysId should be passed into the action
var grGroup = new GlideRecord('sys_user_group');
if (grGroup.get(inputs.groupSysId)) {
var manager = grGroup.manager;
if (manager) {
// Create approval record for the manager
var approval = new GlideRecord('sysapproval_approver');
approval.initialize();
approval.approver = manager;
approval.sysapproval = inputs.targetRecordSysId; // e.g., the RITM or custom record
approval.state = 'requested';
approval.insert();
outputs.managerSysId = manager;
}
}
})(inputs, outputs);
This action creates approval for the manager, but if you just need group manager, you can get that too and use it in next steps of the flow.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
52m ago
thanks so much for your help @pavani_paluri ! I'll give this a shot.
I don't quite understand what you mean by "This action creates approval for the manager, but if you just need group manager." I am wanting to send the approval to sys_user_group.manager. Does that change anything in the script?
thx!
CSA, Senior Enterprise Application Analyst
ServiceNow DevOps
Children’s Health System of Texas
Dallas, Texas, USA
