flow designer approval
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2024 06:59 PM - edited 07-01-2024 09:00 PM
Hi All,
I am moving a workflow to flow designer but i am having some issues. Hence, your help will be appreciated it.
1 - in my workflow i request approval to more than a group. one is fixed and the others are based on the business application selected. I managed to add approvals, but one user from a group approves, others from same group are not set to "no longer required' and it completes the request without waiting for the rest of the groups to approve.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2024 08:24 PM
Hi @El Cuchi
for easy approach and complexity, you didnt need to write the script for the approvals in flow designer, as it is handling easily without code.
Add a Action ---> Ask for Approval
Click on Group icon and select your both groups.
Done
Please Mark this Helpful and Accepted Solution. If this Helps you to understand. This will help both the community and me..
- Keep Learning
Thanks & Regards
Deepak Sharma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2024 08:37 PM
Hi Deepak,
when u look at the script you can see that the name of the groups are not fixed. Hence, your option won't work.
regards,
Max
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2024 08:48 PM
HI @El Cuchi
Got your point, for this requirement just create a new Action and Add Inputs that your script would need (for example, business_applications_affected).
In the Outputs section, define the output variable like approvers.
(function execute(inputs, outputs) {
var answer = [];
var approvers = 'a7923e8edbe429103985be43f3961941';
var app = inputs.business_applications_affected.toString();
var gr = new GlideRecord('cmdb_ci_business_app');
gr.addQuery('sys_id', app);
gr.query();
while (gr.next()) {
if (gr.managed_by_group != '') {
approvers += ',' + gr.managed_by_group;
} else if (gr.managed_by_group == '') {
approvers += ',' + gr.application_manager;
}
}
outputs.approvers = approvers;
})(inputs, outputs);
Save and publish your action.
2. Use the Custom Action in Your Flow:
a. In your flow, add the custom action you created.
b. Provide the necessary inputs.
c. Capture the output approvers list provided by the custom action.
d. Use the Create Record action to create approval records for each group appropriately.
var approversArray = approvers.split(',');
approversArray.forEach(function(approver) {
var approvalRec = new GlideRecord('sysapproval_approver');
approvalRec.initialize();
approvalRec.approver = approver;
approvalRec.sysapproval = flow.variables.ritm; //Assuming ritm is an input variable to the flow
approvalRec.insert();
});
Please Mark this Helpful and Accepted Solution. If this Helps you to understand. This will help both the community and me..
- Keep Learning
Thanks & Regards
Deepak Sharma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2024 08:59 PM
hi Deepak,
thx for the tip. i dont find any custom action as u described. would u pls provide more details?
regards,
max