Automatically resend approval requests which are still pending

hong_cheung
Kilo Explorer

Hello,

Currently approval requests are emailed to the relevant approvers.   However they sometimes do not respond.   Is there a way to keep resending the email request until a reply has been received?

Many thanks,

Hong

30 REPLIES 30

That makes sense, I abounded that method and went with Jamie's solution.



But thank you so much for the help.


justin_drysdale
Mega Guru

What you are asking is entirely doable!   I setup Approval Reminders in our instance.



It runs as a scheduled job and sends out notifications based on a time window ( 3 days with no approval, 5 days, 12 days, etc).


Masha
Kilo Guru

Here all of you go, enjoy!


1. Create an event in the Registry: approval.reminder


2. Create an Email Notification triggered by the above event.


3. Copy the code below into the appropriate tables:


Scheduled Job:


var ar = new ApprovalReminder();


ar.sendReminders();



Script Include:


var ApprovalReminder = Class.create();


ApprovalReminder.prototype = {


    initialize : function () {


          // get the interval time


          this._stale_interval = gs.getProperty("YOUR_PROPERTY_HERE");


    },



    sendReminders : function() {


          // get the old approvals


          var approvals = new GlideRecord("sysapproval_approver");


          approvals.addQuery("state", "requested");


          approvals.addQuery("sys_created_on", "<=", gs.hoursAgo(this._stale_interval));


          var orCondition = approvals.addQuery("u_last_reminder_sent", "");


          orCondition.addOrCondition("u_last_reminder_sent", "<=", gs.hoursAgo(this._stale_interval));


          approvals.query();


     


          // trigger an event for each one


          while (approvals.next()) {


                gs.eventQueue("approval.reminder", approvals, null, null);


                approvals.u_last_reminder_sent = gs.nowDateTime();


                approvals.update();


          }


    }


}


Hi Masha,



I have to write an email reminder functionality. One email should be sent to one approver for 30 days and on the 31st day approval record should be cancelled.


Please help me on this


Thank you, works like a charm 🙂