Notification to trigger 2 months before the record end date

abhilashsg
Tera Contributor

i am trying to achieve above requirement in flow designer. Trigger as scheduled daily but i need help in date validation if end date is 2 months from today then trigger the notification.

 

is this possible achieve scripting via flow variables

7 REPLIES 7

@Ankur Bawiskar  : Thank you but when i tried this filter, it doesn't stop sending the next day:

abhilashsg_0-1755084641455.png

Could you suggest

 

Its_Azar
Tera Guru

Hi @abhilashsg 

Yes, this is possible in Flow Designer by using a scheduled daily trigger. You can use the "Run Script" action or a data transform to compare the record’s end date. If the calculated date matches the record’s end date, you can proceed to send the notification. This logic can be implemented through a script in a flow variable or by using Flow Designer’s date functions.

 

☑️ If this helped, please mark it as Helpful or Accept Solution so others can find the answer too.




Kind Regards,

Mohamed Azarudeen Z

Developer @ KPMG

 Microsoft MVP (AI Services), India

Rafael Batistot
Tera Sage

hi @abhilashsg 

 

May you try via schedule job and call an event to send the notification 

 


var today = new GlideDate(); // current date 
var twoMonthsLater = new GlideDate();
twoMonthsLater.addMonthsLocalTime(2 ); // Remove the space in parentheses)

var gr = new GlideRecord('your_table'); 
gr.addQuery('end_date', twoMonthsLater.getValue()); // exact match
gr.query();

while (gr.next()) {
gs.info('Record ' + gr.sys_id + ' has an end date exactly 2 months from today.');

// Send notification (example: Event)
gs.eventQueue('custom.notification.event', gr, gr.assigned_to, '');
}