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

david_legrand
Kilo Sage

Hi Hong,



If your question is "Do we have an OOB method to do it with just configuration?" the answer is unfortunately no.



If your question is "Could I do it by any way?" The answer is yes by using "scheduled job" and in that case you should try to define when you want to do like.



XX days after the creation of the approval request, I want to resend every morning at xxh the email...



And for the example to follow, you can try to take a look on "incident autoclose" business rule.



Regards,


casey_barela1
Kilo Expert

Hong,


Just wondering if you ever made this scheduled Job. We are looking to do the exact thing you are trying to do. But when i look at the Business Rule incident autoclose i get a head ach like most times i look at java script.



If you have successfully done this would you share the code?



Thanks in advance.


Casey


jamie_girouard
Giga Expert

Interesting that I found this, since I'm looking at the same requirement.



Beyond a scheduled job, another thing we're looking into is adding something to the change workflow that says if it is "x" hours before the change is set to start and you don't have all the approvals, then go ahead and resend approval notifications to anyone who hasn't approved but is supposed to.



I have a pretty good idea of how the code would work, but I was wondering if anyone's done that in practice and how it worked out for them?


Makosko
Tera Expert

I`ve implemented an UI action called "Resend Approval Email"... see whether that meets your requirements or perhaps you can modify it further....



function resendApprovalEmail (cur){


            var event = '';


            var gr = new GlideRecord("sys_email");


                    gr.addQuery("instance", cur.getValue("sys_id"));


                    gr.addQuery("type", "sent");


                    gr.orderByDesc("sys_created_on");


                    gr.query();




              if (gr.next()){


                      var gr_event = new GlideRecord("sys_email_log");


                              gr_event.addQuery("email", gr.getValue("sys_id"));


                              gr_event.query();




                      if (gr_event.next()) {


                              event = gr_event.event.getDisplayValue();


                              if (event == '') {


                                      event = gr_event.notification.event_name.getDisplayValue();


                              }


                      }            


              }




              if(event != ""){


                    //gs.addInfoMessage(event);


                    gs.eventQueue(event, cur, gs.getUserID(), gs.getUserName());


                    return true;


              }


              return false;  


      }



// Call from within your UI action script as follows:


resendApprovalEmail (current)


UI Action Condition could be: current.state == "requested"