- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2019 07:59 AM
Hi folks,
I am working on a Script scheduled job that would clear records on a table based on their date of creation < last 13 months
I would use a Glide record and am trying to construct the Encoded query. More specifically I am trying to code the "<last 13 months" into my query but it does not work.
For example, in standard, "last 12 months" condition is available but not "last 13 months"
I have been tinkering with the encoded query:
- "sys_created_on<javascript:gs.beginningOfLast13Months()" -> does not work
- "sys_created_on<javascript:new GlideDateTime().addMonthsLocalTime(-13);" -> does not work
I have a workaround which consists of converting 13 months into days but I 'd prefer to user it as a last resort:
- "sys_created_on<javascript:gs.daysAgo(396)" -> ok if not a better option
Thank you in advance for your help!
Maron
Solved! Go to Solution.
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2019 05:37 AM
Hi,
I eventually found out the answer. Sorry for the late update. I don't connect often:
var encodedQuery="endISNOTEMPTY^end<javascript:gs.monthsAgo(13)^NQendISEMPTY^sys_created_on<javascript:gs.monthsAgo(13)";
regards,

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2019 08:00 AM
you can create your own dynamic filter and use it in filter.
https://docs.servicenow.com/bundle/london-platform-user-interface/page/use/using-lists/task/t_DynamicFilterOptions.html
REgards,
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2019 05:37 AM
Hi,
I eventually found out the answer. Sorry for the late update. I don't connect often:
var encodedQuery="endISNOTEMPTY^end<javascript:gs.monthsAgo(13)^NQendISEMPTY^sys_created_on<javascript:gs.monthsAgo(13)";
regards,