- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-20-2022 09:32 PM
Hello Guys,
For the above approach we can use schedule job but my question, we want to check record by record suppose lets say we have 10 records which meets the condition( end date is exactly equal to 15 days from current date) then we must send 10 notifications ( each record one notification)
Can anyone give me some idea how to send notification from each record when it meets the condition( i have to include the several record specific data in the Notification )
Thanks,
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-20-2022 10:34 PM
Hi,
the encoded query I gave checks if end date is after 15 days from now and before 16 days from now
so it should give exact 15 days
If that doesn't work you can iterate and find the difference in days between now time and the end date and if it is 15 then send email
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-21-2022 11:34 AM
It works and i slighly modified as below.
u_end_dateRELATIVEGT@dayofweek@ahead@14^u_end_dateRELATIVELT@dayofweek@ahead@16
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-21-2022 08:20 PM
so the above gives exact 15 days from now?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-24-2022 11:17 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-24-2022 11:20 PM
I have used the option you mentioned. Possibly because of timezone
Then you will have to iterate and find the difference in days
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-20-2022 10:16 PM
Eventually you need to write scheduled job for triggering events.
When it comes to how to check 15 days before end date, check true on "Conditional" check box on scheduled job, below code snippet should help.
var start = new GlideDateTime();// current date time
var end = new GlideDateTime(current.due_date);
var diff = GlideDateTime.subtract(start, end);
var days = diff.getRoundedDayPart();
gs.info("no of days = "+ days);
Aman Kumar