The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Does the current time fall within a schedule?

will_smith
Mega Guru

The ask is to have the record producer send incidents to a different assignment group for after hours work in a different timezone. To begin work on this, I have set up a schedule [cmn_schedule] and am wanting to create a script that will run against a record producer to determine if it's after hours and update the assignment group accordingly.

Is there a way I can query the schedules table and see if the current date/time falls within the schedule?

Thanks for all your help! I'm also open to other ways to accomplish this, but I figured schedules was a good place to start since it would handle time zones nicely.

1 ACCEPTED SOLUTION

Hi William,



Upon closer inspection, your schedRec.get() will likely not work. With one argument, this method is looking for a sys_id. You gave it a name. You should change it to:



if (!schedRec.get('name', 'Overnight Hours (Sogeti RIM)'))


    return 'no';



As for the rest, I recomment testing it in scripts background to ensure your functionality before deploying it in a business rule, workflow script activity, etc.



This should help (I just made it last night because this comes up so often.)


Faster Server Side Script Development and Test




View solution in original post

11 REPLIES 11

Chuck Tomasi
Tera Patron

Thanks Mr. Tomasi! Not sure how that did not come up in my search. That article was very helpful!



I am having some troubles with the time zone changer in Geneva (Activate the Time Zone Changer ), I have the UI macro active but am not seeing anything in the header bar. The preferences for the roles are admin and itil. Any thoughts on why this isin't showing?


Hi William,



Are you using UI15 or UI16?


UI16. I bet that's why, huh?