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.

How to identify the date is holiday or not from calendar

HexWIreless
Kilo Contributor

Hi All,

I am new to service now and I need to identify the date I specify is holiday or not from the entry in Calendar, also need to know if its working day then what are the working hours for that day from Calendar.

I know these all things I can find from Calendar but I don't know how can I write script to access those details from Calendar.

Thank you

1 ACCEPTED SOLUTION

Mike Patel
Tera Sage

Where exactly you want this info to be displayed?

you can do something like 

var schedId = 'sys id of your schedule';

 

var sched = new GlideSchedule(schedId);

var d = new GlideDateTime();

if(sched.isInSchedule(d)){

gs.log("In schedule");

}else{

gs.log("Not in schedule");

}

View solution in original post

6 REPLIES 6

Mike Patel
Tera Sage

Where exactly you want this info to be displayed?

you can do something like 

var schedId = 'sys id of your schedule';

 

var sched = new GlideSchedule(schedId);

var d = new GlideDateTime();

if(sched.isInSchedule(d)){

gs.log("In schedule");

}else{

gs.log("Not in schedule");

}

Thanks for your reply, It was really a very helpful to me.

 

Please mark answer correct so it gets removed from unanswered list.

Hello,

Is it possible to get the name of the Entry that gives true/false for a specific time?

With regards
Anton