Schedules - How can we know which schedule is currenlty running or active according to its own tz?

siva91
Tera Contributor

Hi All,

 

How can identify an a schedule entry is active?

 

Lets take a example:

I created a schedule, inside that I created a schedule entry like below Screenshots.

Schedule:

siva91_2-1747127865175.png

schedule entry:

 

siva91_1-1747127832266.png

 

In my case schedule is from 8AM to 7pm PST MON to FRI , but consider I am in different time zone. How can I know if the schedule entry is currently running or say active?

 

To simply put:  I want to check if a schedule is currently running according to the schedule’s own time zone (e.g., PST), regardless of the system/server time zone?

 

#dev #HRSD#ITSM

3 REPLIES 3

shantanu_patel8
Mega Guru

@siva91  You can use the "Show schedule" related link in the schedules. Depending on the logged in user it gives us the exact time when the schedule is active. 

 

Please mark the answer helpful and correct if it helps the issue. Happy scripting 🙂

-Shantanu

@shantanu_patel8thanks, but what if  I need to use in scripting? To be precise I have a widget in esc portal that will show a message. But I need to show the widget only when this schedule entry is active, if its not active I should hide it

You can use isInSchedule(date) method to check if the "date" passed as parameter is in schedule or not.

 

Please refer https://www.servicenow.com/docs/bundle/vancouver-api-reference/page/app-store/dev_portal/API_referen...

 

The above url should give you the detail on how you can use it in a script.

 

Please mark the answer helpful and correct if it helps the issue. Happy scripting 🙂

-Shantanu