Skip to content

Commit 798740a

Browse files
authored
readme.md
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 1696345 commit 798740a

File tree

1 file changed

+15
-0
lines changed
  • Scheduled Jobs/Reject approvals created before an year

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
**Creating a GlideRecord Object:**
2+
var grAppr = new GlideRecord("sysapproval_approver");
3+
4+
**Adding an Encoded Query:**
5+
grAppr.addEncodedQuery("sys_created_on<javascript:gs.beginningOfLast12Months()^state=requested");
6+
7+
**Executing the Query:**
8+
grAppr.query();
9+
10+
**Iterating Through the Results:**
11+
while(grAppr.next()){
12+
13+
**Updating the State:**
14+
grAppr.setValue('state', 'rejected');
15+
grAppr.update();

0 commit comments

Comments
 (0)