Triggering event

Ankita9793
Tera Contributor

 

Hi All,

 

I have a requirement to trigger reminder notification 3 days and 14 days before expiry. As of now it triggers 3 days before the expiry. Can someone please suggest, how i can iterate the reminderDate. What should be right way to do it? 

 

As of now REMINDER_DAYS is set to -3 so it triggers notification 3days prior to the expiry.

 createDelegateReminderEvent: function() {
        var reminderDate = new GlideDate();
        reminderDate.setValue(gs.daysAgo(this.REMINDER_DAYS)); //REMINDER_DAYS is set to -3
       
        var query = "^u_process_onBETWEENjavascript:gs.dateGenerate('" + reminderDate + "','start')@javascript:gs.dateGenerate('" + reminderDate + "','end')";
        var eventRecord = new GlideRecord(this.EVENT_TABLE);
        eventRecord.addEncodedQuery('^u_state=ready^u_event_name=' + this.EVENT_NAME + query);
        eventRecord.query();
        while (eventRecord.next()) {
            gs.eventQueue(this.REMINDER_EVENT_NAME, eventRecord, eventRecord.u_associate_record.sys_id, 'warn'); //REMINDER_EVENT_NAME - This will trigger mailbox delegation expiry reminder notification to user
        }
    },
2 REPLIES 2

Mark Manders
Mega Patron

Why not create a daily flow to check on the reminder date on the record and if that's either in 3 days, or in 14 days, trigger the notification. 


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Ankita9793 

 

I am not a coder/ pro but as per your issue, Flow Designer is best way. 

 

https://www.servicenow.com/community/now-platform-forum/flow-design-to-trigger-reminder-email-and-se...

 

https://www.servicenow.com/community/developer-forum/send-reminder-emails-through-flow/m-p/2752851

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************