Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

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

1 ACCEPTED SOLUTION

@abhilashsg 

You can enhance the logic as per your requirement, I just gave a reference

Thank you for marking my response as helpful.

If my response helped please mark it correct and close the thread so that it benefits future readers.

 

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 10x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

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
Mega Sage

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,
Azar
Serivenow Rising Star ⭐
Architect@ KPMG.

Rafael Batistot
Kilo Patron

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, '');
}

If this response was helpful, please mark it as Helpful and, if applicable, as Correct.
This helps other users find accurate and useful information more easily