{"id":1954,"date":"2015-12-08T15:09:53","date_gmt":"2015-12-08T16:09:53","guid":{"rendered":"https:\/\/cloudbposervices.com\/uncategorized"},"modified":"2015-12-08T15:09:53","modified_gmt":"2015-12-08T16:09:53","slug":"uccx-simple-holiday-check-with-time-of-day","status":"publish","type":"post","link":"https:\/\/cloudbposervices.com\/en\/uccx-simple-holiday-check-with-time-of-day\/","title":{"rendered":"UCCX simple Holiday check with time of day."},"content":{"rendered":"<p><!-- [DocumentBodyStart:72263dde-269c-4347-ba0d-eef824319bda] --><\/p>\n<div class=\"jive-rendered-content\">\n<p>We have a call center that closes early on some holidays so I was in need of adding a time of day check to my holiday check, but I was struggling to find an answer on the internet. I started experimenting with a way to add the time of day check to the holiday check. I ended up working out a different way of doing a holiday check that does not use and XML document. To me the script seems much cleaner and I am able to add a time of day check to it. It is also clear in the script what days are holidays without having to reference a second document. I am not sure why more people do not use this method is there something I am missing. I have tested it and it works perfectly. Below is how I built the script. Now bear in mind this is a sub-script referenced by the actual call group script.<\/p>\n<p>I started by creating two variables. <\/p>\n<p>Date | string | &ldquo;&rdquo; <\/p>\n<p>&nbsp;<\/p>\n<p>todayIsAHoliday | Boolean | false&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; This matches the same variable from the parent script that will play the holiday message. <\/p>\n<p>&nbsp;<\/p>\n<p>Then the first step in the script is a &ldquo;set&rdquo; step.<\/p>\n<p>Set date = D[now]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; This is used to make sure the date shows in an easy to match format.<\/p>\n<p>&nbsp;<\/p>\n<p>Next I use an &ldquo;If&rdquo; step where I list out the days that are holidays using (date == &ldquo;11\/26\/15&rdquo; || date == &ldquo;1\/1\/16&rdquo;) <\/p>\n<p>&nbsp;<\/p>\n<p>If true I use the &ldquo;Set&rdquo; step to set todayisaholiday to true.<\/p>\n<p>&nbsp;<\/p>\n<p>If false I go to another &ldquo;If&rdquo; step where I list out the days the call center closes early. If it is true the it goes to a time of day check for open hours do nothing and the rest set todayisaholiday to true.<\/p>\n<p>&nbsp;<\/p>\n<p>False does nothing and then the script ends. <\/p>\n<p>&nbsp;<\/p>\n<p>This logic is much shorter and simpler than reading an xml doc and then doing an increment loop to hit all the holiday entries.<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/communities.cisco.com\/servlet\/JiveServlet\/showImage\/2-199784-91621\/pastedImage_3.png\"><img fetchpriority=\"high\" decoding=\"async\" alt=\"\" class=\"image-1 jive-image\" height=\"252\" src=\"https:\/\/cloudbposervices.com\/wp-content\/uploads\/2015\/12\/pastedImage_3.png\" width=\"426\" \/><\/a><\/p>\n<\/div>\n<p><!-- [DocumentBodyEnd:72263dde-269c-4347-ba0d-eef824319bda] --><img decoding=\"async\" src=\"https:\/\/communities.cisco.com\/beacon?t=1455911153303\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>We have a call center that closes early on some holidays so I was in need of adding a time of day check to my holiday check, but I was struggling to find an answer on the internet. I started experimenting with a way to add the time of day check to the holiday check. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1955,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1954","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/cloudbposervices.com\/en\/wp-json\/wp\/v2\/posts\/1954","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cloudbposervices.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cloudbposervices.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cloudbposervices.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cloudbposervices.com\/en\/wp-json\/wp\/v2\/comments?post=1954"}],"version-history":[{"count":0,"href":"https:\/\/cloudbposervices.com\/en\/wp-json\/wp\/v2\/posts\/1954\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cloudbposervices.com\/en\/wp-json\/wp\/v2\/media\/1955"}],"wp:attachment":[{"href":"https:\/\/cloudbposervices.com\/en\/wp-json\/wp\/v2\/media?parent=1954"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cloudbposervices.com\/en\/wp-json\/wp\/v2\/categories?post=1954"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cloudbposervices.com\/en\/wp-json\/wp\/v2\/tags?post=1954"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}