How to trigger a notification when due date is approaching? using flow designer

Sathwik1
Tera Expert

In a table I had a field "Due Date" now suppose

              -> When due is approaching in 30 days I need to trigger a notification...

              -> and when due date is approaching in 15 days again need to trigger a notification..

Is it possible by using flow designer? if so can anyone help me please...I am not getting how to set the condition to calculate 30 and 15 days using flow designer...

1 ACCEPTED SOLUTION

Community Alums
Not applicable

Hi Sathwik,

Hope you are safe and good.

You can try this with scheduled jobs.

  1. Create an event in the registry.
  2. Create a Scheduled script execution which runs daily at 0800 hrs. 

        var chg_req=new GlideRecord('change_request');
               chg_req.addEncodedQuery('active=true^due_dateRELATIVEGT@dayofweek@ahead@29^due_dateRELATIVELT@dayofweek@ahead@31^NQdue_dateRELATIVEGT@dayofweek@ahead@14^due_dateRELATIVELT@dayofweek@ahead@16');
     chg_req.query();
       if(chg_req.hasNext())
       {
          while(chg_req.next())
           {
              gs.eventQueue('change_request.schedule_reminder',gr,gr.assigned_to.email,'');
           }
       }

    3. Create notification which sends the notification when the event got triggered.

In this example I have used Change Request table. Replace the table name in the glide record also due_date field name.

Please click on helpful if it is.

 

 

Thanks & Regards,

Sharath Allam

Kaptius - ServiceNow Premier Partner.

View solution in original post

17 REPLIES 17

Community Alums
Not applicable

Hi Sathwik,

Hope you are safe and good.

You can try this with scheduled jobs.

  1. Create an event in the registry.
  2. Create a Scheduled script execution which runs daily at 0800 hrs. 

        var chg_req=new GlideRecord('change_request');
               chg_req.addEncodedQuery('active=true^due_dateRELATIVEGT@dayofweek@ahead@29^due_dateRELATIVELT@dayofweek@ahead@31^NQdue_dateRELATIVEGT@dayofweek@ahead@14^due_dateRELATIVELT@dayofweek@ahead@16');
     chg_req.query();
       if(chg_req.hasNext())
       {
          while(chg_req.next())
           {
              gs.eventQueue('change_request.schedule_reminder',gr,gr.assigned_to.email,'');
           }
       }

    3. Create notification which sends the notification when the event got triggered.

In this example I have used Change Request table. Replace the table name in the glide record also due_date field name.

Please click on helpful if it is.

 

 

Thanks & Regards,

Sharath Allam

Kaptius - ServiceNow Premier Partner.

@Sharath Allam can you please share me the screenshot of the filter conditions of the encoded query

Community Alums
Not applicable

find_real_file.png

Planned start date is after29 days AND before 31 days.   OR   Planned start date is after14 days AND before 16 days.

Thank you.. but here why "after 29" and before "31" both are used? can you please explain a bit?