Skip to content

Commit 25796ae

Browse files
authored
Reject Approvals Older Than One Year (#1609)
1 parent f2789dc commit 25796ae

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
var grAppr = new GlideRecord("sysapproval_approver");
2+
grAppr.addEncodedQuery("sys_created_on<javascript:gs.beginningOfLast12Months()^state=requested");
3+
grAppr.query();
4+
while(grAppr.next()){
5+
grAppr.setValue('state', 'rejected');
6+
grAppr.update();
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
**Script Purpose:**
2+
This script helps you manage approval records in ServiceNow. It searches for approval requests in the sysapproval_approver table that were created more than 12 months ago and are currently marked as "requested." The script then updates these records to change their status to "rejected."
3+
4+
**How to Use This Script**
5+
Where to Run It: You can execute this script in a server-side context, such as a Scheduled Jobs, Script Include, or Background Script. Make sure you have the necessary permissions to access and update records in the sysapproval_approver table.
6+
7+
**Be Cautious:** The script will automatically find the relevant approval records and update all matching records, so double-check the criteria before executing it.

0 commit comments

Comments
 (0)