Encoded query for exactly 60 days and 90 days
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-16-2022 12:32 AM
Hi all,
I've trying to set up a scheduled job that runs daily and identifies records exactly 60 days old and 90 old to notify the user to update.
I initially used encoded query active=true^sys_updated_onRELATIVELT@dayofweek@ago@60 and the same for 90 but that sends the user a daily email - I only want to send it once. I also tried the below without success
sys_created_onRELATIVEGT@dayofweek@ago@59^sys_created_onRELATIVELT@dayofweek@ago@61
Does anyone have any experience of scripting something like this?
Appreciated as always!
Richard
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-16-2022 02:18 AM
You can check script shared by Mahendra and share us the updates.
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
2 weeks ago
If anyone is coming to this thread lately, the original poster was close to correct.
I had a similar requirement, except mine was looking for records exactly 90 days in the future.
In the below example, u_expiration is a date time field some time in the future. My requirement was to find records which were 90 days in the future, and triggering a notification based on that record.
The list filter is:
Expiration After Relative 89 days from now + Expiration Before Relative 91 days from now
or
u_expirationRELATIVEGT@dayofweek@ahead@89^u_expirationRELATIVELT@dayofweek@ahead@91
When working with date/time fields, given time zone differences, this may be contingent on when in the day the search is run (if from a scheduled job), and when the date/time stamp was set. But the above is the general idea.
