- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2025 05:15 AM
I have requirement where a catalog item 'After hours support' form should be only visible outside of working hours i.e. It should be only visible between 5pm EST and 8 am EST. After 8am link should not be visible on portal till 5pm. Can you suggest how to do it ?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2025 05:34 AM
you can create a User Criteria with script and use Schedule script
Then add this User Criteria in "Available For" related list of your catalog item
// Get current time in UTC
var gdt = new GlideDateTime();
// Convert UTC to EST (Eastern Standard Time)
// EST is UTC-5; adjust for daylight saving if necessary
// For robust handling, use GlideDateTime's setTZ method if your instance supports it
gdt.setTZ('America/New_York'); // This will handle EST/EDT automatically
var hour = parseInt(gdt.getHourLocalTime(), 10);
// Allow access if time is 5pm (17) or later, or before 8am (8)
if (hour >= 17 || hour < 8) {
answer = true;
} else {
answer = false;
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2025 05:34 AM
you can create a User Criteria with script and use Schedule script
Then add this User Criteria in "Available For" related list of your catalog item
// Get current time in UTC
var gdt = new GlideDateTime();
// Convert UTC to EST (Eastern Standard Time)
// EST is UTC-5; adjust for daylight saving if necessary
// For robust handling, use GlideDateTime's setTZ method if your instance supports it
gdt.setTZ('America/New_York'); // This will handle EST/EDT automatically
var hour = parseInt(gdt.getHourLocalTime(), 10);
// Allow access if time is 5pm (17) or later, or before 8am (8)
if (hour >= 17 || hour < 8) {
answer = true;
} else {
answer = false;
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2025 05:44 AM
Run 2 scheduled jobs at the specific time to activate/deactivate the item.
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark