Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Floating schedules from time zone context when used in a business rule

Valqe
Tera Expert

Hi all,
I'm struggling to understand floating schedules from time-zone context when used in Business Rule and I was hoping your comments will help.


This is my scenario.
I have fulfillers in different time-zones.  I have 8-5 schedule I want to use. 
I want a business rule to trigger mobile notification to 'assigned_to' user [incident] when following condition is met:

1. Assined_to field is populated and hours are outside of 8-5 schedule.

Question: How to make my  BR 'aware' of assigned_to user time zone in context of 8-5 local schedule?

So far I have created following script prototype, but it does not account for assigned_to field value user time zone.

find_real_file.png

Thank you for your comments.

V.

3 REPLIES 3

VaranAwesomenow
Mega Sage

Thank you for your reply Anil.

Question: How would you script user record time-zone field value in a business rule IF condition (line 5 below)?
P.S. Business rule runs on [incident] table and "assigned_to" field is user field whose time-zone has to be checked in IF condition.

Thank you

find_real_file.png

Anil9866
Tera Contributor

Hi @Valqe 

I guess in the mentioned 8-5 schedule sysID of the calendar, may I know what is the timestamp. Because I've tried the same script by changing the timestamp of the 8-5 schedule. 

1) First change the schedule year from 2008 to 2025(Present) then try to check

I've tried the same and it worked for me. The validation is done. 
Now you can adjust it accordingly to your user's timezone. Like first get the time in GlideDateTime(), then convert it to user's timezone and then perform isInSchedule() validation. 

Hope you'll try this and let us know the result. 

Thanks