Policy Exception Approval Rejections to be routed back to REVIEW state
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2024 12:56 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2024 12:58 AM
Once a policy exception approvals (which is generated after the review state) is rejected/requested more info, It is routing back to the requester of the policy exception. We need this to come back to review state and assign to the group who actually raised the approval from the review state.
How we can do this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2024 12:21 AM
To route a rejected or more info requested policy exception back to the review state and reassign it:
- Create a Business Rule on the Policy Exception table.
- Script: When state is Rejected or Requested for More Information, set current.state to Review and assign it to the group that raised the initial approval.
// Function to get the initial approver group
function getInitialApproverGroup(recordId) {
var gr = new GlideRecord('your_approval_table'); // Replace with your table
gr.addQuery('policy_exception', recordId); // Adjust query based on your data structure
gr.query();
if (gr.next()) {
return gr.assignment_group; // Adjust field name as necessary
}
return ''; // Default or handle as needed
}
// Business Rule Script
(function executeRule(current, previous) {
if (current.state == 'Rejected' || current.state == 'Requested for More Information') {
current.state = 'Review'; // Ensure this is the correct review state value
current.assignment_group = getInitialApproverGroup(current.sys_id);
current.update();
}
})(current, previous);
…………………………………………........................................................................................
Mark it helpful 👍and Accept Solution ✅!! If this helps you to understand.
…………………………………………........................................................................................