Seeking Community Advice on Change Request Approval Workflow

Meera_P
Tera Expert

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

 

Meera_P_0-1718993885454.png

 

1 ACCEPTED SOLUTION

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:

  1. Navigate to System Definition > Business Rules.
  2. Click New to create a new business rule.
  3. 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.

View solution in original post

5 REPLIES 5

Hi @HrishabhKumar 

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