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.

how create schedule to trigger notification expiry for due or over due using flow designer

Arun_Manoj
Mega Sage

hi,

 

I need a help , how to create the schedule to trigger notification expiry for due or over due using flow designer,

how the fetch the record and condition for the day (eg:7 days or 7days overdue) how to calculate those condition. How to trigger the event trigger notification.

 

7 REPLIES 7

@Arun_Manoj 

 

Did you get a chance to review this ?

 

If my response helped to answer your query, please mark it helpful & accept the solution.

 

Thanks,

Bhuvan

Mitsua
Tera Guru

Hello @Arun_Manoj 

 

We can achieve this through scheduled job as well.

 

Create Scheduled job and set it to run Daily so daily it will check records created at or before specific days.

 

You can use below script . (Tested on my PDI)

var incRecord = new GlideRecord('incident'); // add your table name
incRecord.addEncodedQuery('active=true'); // Fetching all active incident records
incRecord.query();

while (incRecord.next()) {

    // Get the 'opened_at' datetime field. You can add field name from which you want date 
    var gdt = new GlideDateTime(incRecord.opened_at);

    // Convert datetime to date only
    var dateOnly = gdt.getDate();

    // Get current date
    var currentDate = new GlideDate();
    currentDate.getByFormat("yyyy-MM-dd"); // Format current date to match incident date format

    // Subtract 6 days from current date
    currentDate.addDaysLocalTime(-6);

    // Check if the incident was opened exactly 6 or more days ago
    if (currentDate.getDisplayValue() == dateOnly.getDisplayValue() ||
        currentDate.getDisplayValue() > dateOnly.getDisplayValue()) {

        // Trigger event (replace with actual event name and parameters)
        gs.eventQueue('your_event_name', incRecord, 'param1', 'param2');
    }
}

}

@Arun_Manoj - Let me know if you have any questions

 

Please mark this as correct answer/accepted and helpful if it resolved, or mark this helpful if this help you to reach towards solution.

 

Thank You!

 

 

kaushal_snow
Giga Sage

Hi @Arun_Manoj ,

 

I have worked on similar kind of requirement in the past, below are the steps using Flow Designer...

 

1. Schedule the Flow: Set up a Flow to run daily (or on any interval you prefer) using a Scheduled trigger....


2. Fetch Due or Overdue Records:

Add a Lookup Records action to query your target table (e.g Tasks, RITMs). Use a condition like:

Upcoming due: due_date = today + 7 days / Overdue: due_date <= today – 7 days

You can perform date arithmetic using date fields and ServiceNow functions within the condition builder.

 

3. Loop Through Records: Add a For Each loop to iterate through each matching record...

4. Send Notification: Inside the loop, insert a Send Notification action or an event trigger to alert the relevant users...

5. Add a Flag to Prevent Duplicate Alerts: Use an Update Record action inside the loop to set a custom field (like abc_custom_field) so that the same record isn't repeatedly notified.

If you found my response helpful, please mark it as ‘Accept as Solution’ and ‘Helpful’. This helps other community members find the right answer more easily and supports the community.

 

Thanks and Regards,
Kaushal Kumar Jha - ServiceNow Consultant - Lets connect on Linkedin: https://www.linkedin.com/in/kaushalkrjha/