How do I create a one month or 1 week reminder to trigger the email notification?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2025 01:03 AM
Dear experts,
I am currently stuck in the condition field where I want the system to fetch the date one month before the field value under the sn_risk_risk form u_risk_due_date field value, where it will trigger the email to be send one month before the value? How should I build my condition query in the scheduled jobs? And if so how do I configure for 2 weeks and 1 week reminder as well?
This is my current script:
var gr = new GlideRecord('sn_risk_risk');
if (gr.get(current.sys_id)) {
var currentDate = new GlideDate(); // today's date
var dueDate = new GlideDate(gr.u_risk_due_date); // the record's due date
// Subtract one month from due date
dueDate.addMonths(-1);
// Compare with today
if (dueDate.compareTo(currentDate) == 0) {
answer = true;
} else {
answer = false;
}
} else {
answer = false;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2025 01:09 AM
Why use complex scripting in a scheduled job? If you use a scheduled flow, you can just lookup the date/time and wait until one month before it. The calculation will be done in the action.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2025 06:46 PM
Hi Mark,
Can you explain more detail in how the scheduled flow can be done? Thanks for your reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2025 03:50 AM
You create a flow and trigger it on your schedule (like daily).
You do a look up to all records that are at one month from now and with a 'for each' you use the 'send notification' action to trigger the notification.