- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2023 07:09 AM
Hi,
This may be a basic question, but for some reason I am struggling with it. We have a script that will generate our time sheets every Sunday at noon. In ServiceNow, the week starts on begins on Monday. What I am looking to do is have a notification sent out to users who have not submitted their time sheets for the previous week as of Monday at noon. I can't seem to figure out the query for previous week since time sheets use Sunday as the first day of the week and the system uses Monday. If I use the query in my code for last week, it still pulls the data for the current week. So on Monday, how do I pull the time sheet data created from the previous week to see who has not submitted time. For instance, if the 1st of the month is a Sunday and that is when the time sheet is created, come Monday the 9th, I want to pull the time sheets from the 1st and display who is still pending. Obviously, I need this for every Monday, so I can't simply plug dates in. Any help would be greatly appreciated.
Thanks!!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2023 08:35 AM
If Time Sheets always start on Sundays and you are always running the check on Mondays, it may suffice to check for dates that are between 9 days ago and 1 day ago:
Try it in the list GUI and confirm that you're getting the expected results.
If you need the query for a script, you can right-click on the filter and get an encoded query that you can use as part of a script:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2023 08:35 AM
If Time Sheets always start on Sundays and you are always running the check on Mondays, it may suffice to check for dates that are between 9 days ago and 1 day ago:
Try it in the list GUI and confirm that you're getting the expected results.
If you need the query for a script, you can right-click on the filter and get an encoded query that you can use as part of a script:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2023 09:16 AM
Thanks Nia!