- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2024 11:20 AM
Hi,
I have a workflow issue and I'm seeking suggestions and advice from the community.
The issue concerns the approval process for change requests. As shown in the screenshot below, the process begins with 3 approvers. If any one of them rejects the request, I would like all approval statuses to change to
"No Longer Required," regardless of their current state.
Additionally, I need the Change Request record to move back to the "New" state to restart the approval process.
What options do I have for addressing this? Thank you
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2024 11:56 PM
Hi @Meera_P ,
Yes, You can implement this same logic using Business rules as well.
But, I'll recommend you to take assistance with someone on your instance, so that you don't break something accidentally.
I'm providing the steps to implement a business rule below:
-> Create a Business Rule to Reset Change Request State
Business Rule to Reset Change Request State:
- Navigate to System Definition > Business Rules.
- Click New to create a new business rule.
- Set the following properties:
- Name: Reset Change Request on Rejection
- Table: Change Request [change_request]
- When: Before
- Insert: False
- Update: True
- Delete: False
- Filter Conditions:
- State is not New
- Approval is rejected
Script:
(function executeRule(current, previous /*null when async*/) {
// Check if the current approval is rejected
if (current.approval == 'rejected') {
// Query all related approval records
var approvalGR = new GlideRecord('sysapproval_approver');
approvalGR.addQuery('sysapproval', current.sys_id);
approvalGR.query();
// Set all other approval records to "No Longer Required"
while (approvalGR.next()) {
if (approvalGR.state != 'rejected') {
approvalGR.state = 'not_required';
approvalGR.update();
}
}
// Reset the Change Request state to "New"
current.state = 'new';
current.update();
}
})(current, previous);
Thanks,
Hope this helps.
If my response proves helpful please mark it helpful and accept it as solution to close this thread.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-22-2024 04:19 PM
In the Business Rules you mentioned filter condition "Approval is rejected". On the change request form, how do I display the "Approval" field on the form so I can see what value it is currently holding for troubleshooting purposes. Thank you