- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-01-2019 03:12 PM
How would I script to get a count of records relative to the current date? This wouldn't be a range. It would be specific to a specified number of days like 3 days ago, 2 days ago, etc. (eg Get the number of incidents created 3 days ago relative to the current day)
I tried to see if I could get a filter going by using "Created relative on 3 days ago" but I get zero results. I can easily get a range of records by using on before or after but I can't seem to get records when specifying a specific number of days.
Ultimately, I need to get the difference between incidents created vs resolved per day over 3 days. It wouldn't be a total over 3 days.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-04-2019 04:02 PM
It seems like this is a bug that ServiceNow won't fix. The ability to choose a day relative to the current day is not possible per PRB1017188.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-02-2019 10:43 AM
if you bring up incidents and filter: first column is created, second choose "relative", on or after, 3, days, ago
that is the query above.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-02-2019 10:45 AM
to get the encoded query string, run your query in the list, right click on the filter and select copy query
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-02-2019 10:51 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-02-2019 10:54 AM
don't use "ON"
use "ON OR AFTER"
you have none create exactly 3 days ago
create a record and you will get at least one
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-02-2019 11:01 AM
Wouldn't that give me more results I would need? I would need to get records specifically created in that 12am-11:59pm window 3 days ago.