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 12:51 AM
Hi there,
Have you tried creating such a filter on a list? Then you could just copy the query and use it in your scripting or something.
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
2020-2022 ServiceNow Community MVP
2020-2022 ServiceNow Developer MVP
---
LinkedIn
Community article, blog, video list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-16-2022 01:42 AM
Hello Richard Thomas,
Could you please check once with below query:
var updatedDateGDT = new GlideDateTime();
updatedDateGDT.addDays(-60);
var updatedDate = updatedDateGDT.getDate();
updatedDateGDT.addDays(-30);
var updatedDate1 = updatedDateGDT.getDate();
var query = "sys_updated_onON" + updatedDate +"@javascript:gs.dateGenerate('" + updatedDate + "','start')@javascript:gs.dateGenerate('"+
updatedDate +"','end')^ORsys_updated_onON" + updatedDate1 +"@javascript:gs.dateGenerate('" + updatedDate1 + "','start')@javascript:gs.dateGenerate('" + updatedDate1 + "','end')";
If my answer helped you in any way then please do mark it as helpful. If it answered your question then please mark it correct and helpful. This will help others with similar issue to find the correct answer.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2022 11:38 PM
Hello
Just wanted to check with you, if the above response answered your question. If yes, then please do close this thread/question by marking the appropriate response as correct.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-22-2022 11:08 PM
Hello
Just wanted to check with you, if the above response answered your question. If yes, then please do close this thread/question by marking the appropriate response as correct.
Thanks