Skip to content

Commit 1696345

Browse files
authored
Create Reject Approvals Created Before an Year.js
The overall purpose of this script is to identify and reject approval requests that are older than one year and are still in the "requested" state. This helps in cleaning up old approvals that may no longer be relevant.
1 parent b168e97 commit 1696345

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-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+
}

0 commit comments

Comments
 (0)