Help with Scripting to Filter sys_user Table by Created Column
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2024 02:30 AM - edited 07-16-2024 02:40 AM
Hello,
I am new to scripting in ServiceNow and need assistance with
creating a dynamic filter for a report that extracts data from the sys_user table based on the Created column. I'd like to achieve the following filtering criteria:
- A specific date and time (e.g., 2024-01-01 00:00:00)
- Wednesday 2 weeks ago
- If the current day is Monday or Tuesday, the filter should input the date from 5 days ago. If it is any other day, the filter should input the date from 4 days ago at 23:59:59.
Thank you in advance for your assistance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2024 03:39 AM
Can you please explain the complete use case? What are you trying to achieve? Where exactly are you trying to apply filtering? What type of script are you trying to use for that?
Blog: https://sys.properties | Telegram: https://t.me/sys_properties | LinkedIn: https://www.linkedin.com/in/slava-savitsky/

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2024 04:01 AM
Hi,
Could you please clarify (with some more examples) what you want with this date/how it should be calculated?
Do you want a date that is always on a wednesday 2 weeks before a selected date?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2024 07:50 AM
Yes @OlaN, for the second filter, I want a date that is always on a Wednesday 2 weeks ago.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2024 12:44 PM
If you want to find all users created on Wednesday two weeks ago, try the following filter:
Blog: https://sys.properties | Telegram: https://t.me/sys_properties | LinkedIn: https://www.linkedin.com/in/slava-savitsky/