Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
In certain scenarios, the same approver might appear multiple times in the approval flow for a Change or Request. This code snippet ensures that if an approver has already approved the request once, any subsequent approval requests assigned to them are automatically marked as approved.

###Usage Instructions

Create a new Business Rule on the sysapproval_approver table.
Set the rule to run before insert or update.
Paste the script into the Script field.
Test in a sub-production environment to ensure expected behavior.

###Notes

This rule helps reduce redundant approvals and improves efficiency.
Ensure that business logic and compliance requirements allow auto-approvals before deploying.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
(function executeRule(current, previous /*null when async*/ ) {

var appr = new GlideRecord('sysapproval_approver');
appr.addQuery('document_id', current.document_id);//look for approval requests for same task
appr.addQuery('approver', current.approver); //same approver exists?
appr.addQuery('state', 'approved');
appr.addQuery('group','');//ensure this scenario not applied for group type approvals
appr.query();
if (appr.next()) {
current.state = 'approved';
current.comments = 'Auto-approved due to duplicate approver at multiple levels.';
}

})(current, previous);
Loading