How to detect weekend days
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2016 08:47 AM
I got a requirement -all incident are opened during weekend , their State field must be set to "New". However, their State value -"New" must be converted to "Active" if date is coming to Weekday (Monday - Friday). How can I monitor the date change among Weekend to Weekday?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2016 06:05 PM
getDayOfWeekLocalTime(); will output the day in the users time zone. Unless otherwise specified on the user record, the user will have the system time zone.
3.21 getDayOfWeekLocalTime()
Gets the day of the week stored by the GlideDateTime object, expressed in the user's time zone. This method is available starting with the Eureka release.
3.21.1 Input Fields
Parameters:
- None
3.21.2 Output Fields
Returns: (int) The day of week value, in the user's time zone, from 1 to 7. Monday=1, Sunday=7.
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2016 09:33 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2016 10:19 AM
Can you please also elaborate what the thought process behind this requirement?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2016 10:53 AM
When the user send an email to open an incident, the State vale of new incident must be set to "New" if it is not in business hours (7:am - 7:pm Monday-Friday, or weekend (Sat-Sunday). However, the State value of new incident ticket must be converted to "Active" if days are not weekend, or time is in business hours during weekday.
I hope my requirement is clear enough for you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2016 10:57 AM
Hi Nancyhz,
In that case(Considering Business hours), It would make more sense to go with Schedules. That would be a scalable approach.
Thanks
Srini