Due Date Approval record - Add notes if due date passes?

Adam Peterson
Kilo Sage

Hey experts!

 

We currently requiring comments if they reject an approval which works great when they select reject. On a lot of our approvals through Flow Designer, we have a due date to auto reject after x days.

 

Our question is is there somehow we can write a note in the comments saying this was rejected because the due date has elasped? 

 

Thanks!

1 REPLY 1

PratikshaKate
Tera Contributor

@Adam Peterson You can make use of scheduled job and make it to run on daily basis to check the records which has the due date passed.


var gr = new GlideRecord('sysapproval_approver');
gr.addQuery('state', 'requested'); // assuming the state, you can provide as per your requirement
gr.addQuery('due_date', '<=', new GlideDate());
gr.query();
while (gr.next()) {
gr.comments = "Due date passed. Adding a note.";
gr.update();
}
})();

 

Mark my answer helpful if it works 🙂