5 days before end date, fire notification to a group

Hemamani Prabha
Tera Contributor

Hello all, 

 

There is a date variable "end_date" in application table. As per the requirement, I need to check the date and run a scheduled job 5 days before the end date and send notification to a group. How can this be achieved? Can someone help me with the process as this is my first time doing scheduled job and notification

 

Thanks,

Hema

4 REPLIES 4

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Hemamani Prabha 

 

The best and easiest way to use the flow designed would be:

Trigger: Daily

Action: Wait for [set a condition or time]

Action: Send Notification

This simple flow will trigger daily, wait for the specified condition or time, and then send a notification. You can customize the "Wait for" action based on your specific requirements, such as waiting for a user response or a certain event to occur.

 

https://www.servicenow.com/community/now-platform-forum/how-to-send-a-notification-in-the-flow-desig...

*************************************************************************************************************
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]

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

Hi @Dr Atul G- LNG 
Thanks for your response, but then I have a query here. If it is wait for condition it is not a direct one, I need to fetch the date, validate and check if it is 5 days before the actual end date. How can this be achieved?

Thanks,

Hema

In that case, first, you can get the variable by using:

Action: Get Catalog Variables

Once you have the variable, then you can add the Wait condition to pause the flow until the required conditions are met.

*************************************************************************************************************
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]

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

vamsi55
Tera Contributor

HI @Hemamani Prabha ,


Create schedule job which runs daily at 12 AM and trigger event to send notification 

  • Run: Daily
  • Time: Choose when it should run (e.g., 12 AM)

Below code will be helpful to send notification 5 days before end date .

 

var today = new GlideDateTime();
today.addDaysLocalTime(5); // Move date 5 days ahead
var appGR = new GlideRecord('your_application_table');
appGR.addQuery('end_date', today.getLocalDate());
appGR.query();
while (appGR.next()) {
    gs.eventQueue('custom.end_date_notification', appGR);
}

Please give a like if you find the solution helpful
 
Thanks!