Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

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  ||  9x 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
Tera Guru
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

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 you found this response helpful, please mark it as Helpful. If it fully answered your question, consider marking it as Correct. Doing so helps other users find accurate and useful information more easily.