Andrew Skelly Fri, 10/12/2012 - 16:17
User Badges:
  • Silver, 250 points or more

Create an XML document (like the one attached) that has your company holidays in it.  You'll need to update it each year as the company recognized day changes each year.


You will need to collect the specific day in the script, and then reference the current day against the XML document.  I've include a basic script that only shows how the date collection would look in a scirpt.  There is probably a cleaner way to do this, but this should get you started.

Attachment: 
Justin Westover Fri, 10/12/2012 - 23:44
User Badges:

What is the ownername and ownerteam in the xml script for? I see that is also referenced in the .aef script.

Andrew Skelly Mon, 10/15/2012 - 06:41
User Badges:
  • Silver, 250 points or more

Those are just the names of the fields in the XML document.  You can call them whatever you want.  I quick copied another XML I had to put the dates in there.  The script needs to know which fields in the XML it is looking at for data, so you need to specify in the script.


You can change the names to "Recognized Date" and "Company Holiday" or anything else you would like.  Just make sure whatever you call them in the XML you also reference in the script.

Anthony Holloway Mon, 10/15/2012 - 09:02
User Badges:
  • Purple, 4500 points or more

I'm actually really curious as to why the XML based solution for Holidays took off like it did.  Don't get me wrong, it's certainly a good option, and I have used it many times in the past myself.  I'm just curious.


Anyway, here's an alternate solution to the XML one Andrew posted, and the many others that exist on the forum.  We will explore using a Date array in lue of an XML document, and you simply call it via Subflow looking for the return value of "is_holiday."  It's pretty light weight.


Some benefits include:

  • Shareable between all scripts as a subflow (just like XML docs are)
  • Validates Date input at time of entry (XML docs can contain typos or improper formatting of dates)


Filename: holidays.aef

Variables

Date holiday = null

Date[] holidays = new Date[] {D[11/22/2012], D[11/23/2012], D[12/25/2012]}

Iterator holidays_iterator = com.cisco.util.EmptyIterator.iterator

boolean is_holiday = false

Date today = D[now]


Script

Start

Set holidays_iterator = holidays.iterator

Label Read Next Holiday

If (holidays_iterator.hasNext())

  True

    Set holiday = (Date) holidays_iterator.next()

    If (holiday.month == today.month && holiday.date == today.date && holiday.year == today.year)

      True

        Set is_holiday = true

        Goto End of Script

      False

        Goto Read Next Holiday

    False

      Goto End of Script

Label End of Script

End


So, that's the subflow, and this next script is your Main AA script.  I will omit everything except for the pieces necesary to use the holiday subflow.  It only uses a single variable, and two script steps.


Filename: main_aa.aef

Variables

boolean is_holiday = false


Script

Start

...answer, greet, etc...

is_holiday = Call Subflow(SCRIPT[holidays.aef], is_holiday)

If (is_holiday)

  True

    /* Today is a holiday */

    ...holiday treatment...

  False

    /* Today is not a holiday */

...the remainder of the AA...

End


You could take this a step further and include timezone support by taking in an input parameter of type Timezone and name timezone, and then generate your today variable at runtime like so:


Set today = D[D[now], timezone]


You could also leverage the input parameter of the holidays Date array, which would override the default array.  Or even specify a new Date array called holidays_include to allow the inclusion of some additional holidays. You would just repeat the actions in the script for both variables.


Challenge: How could you implement a holidays_exclude feature?


Anthony Holloway

Please use the star ratings to help drive great content to the top of searches.

davidoconnor2010 Thu, 10/25/2012 - 06:15
User Badges:

Thanks Anthony.  I'm now on 8.5 and your suggestion works. A previous suggestion from you using xml worked for me on 7 so instead of searching for 8.5 holiday scripts I searched for your name on the forum!







Anthony Holloway Thu, 10/25/2012 - 08:20
User Badges:
  • Purple, 4500 points or more

Oh dear!  I better not start posting in the IP Telephony forum, it might delute your searches for UCCX solutions!


Thanks for the feedback, it's appreciated.


Anthony Holloway

Please use the star ratings to help drive great content to the top of searches.

Mohamed Shameer... Tue, 01/29/2013 - 09:34
User Badges:

Hi Anthony


I used your method and its working

going to implement this for a client next week


Thanks

shameer

stavropouloss Mon, 06/17/2013 - 02:53
User Badges:

I tried to understand what you're saying but didn't manage it. The presentation you're doing with the date variables. My java/programming/whatever way of thinking is not developed :/ . I'm just a humble network engineer

richard.grey Sun, 04/20/2014 - 13:04
User Badges:

Hello Anthony,

Can you take a look at my scripts and let me know what I may be missing as it seem like my is_holiday variable keeps changing to true regardless of what is in the Date Array.

 

Thanks

Richard

Attachment: 
richard.grey Sun, 04/20/2014 - 14:59
User Badges:

Hello Sam,

Thanks for your input, that worked like a charm yes

 

Thanks for you help

Rich

sbhatcher Mon, 06/29/2015 - 15:17
User Badges:

Sam Womack!  Good work as usual!  Works like a charm.

sdeckert Tue, 03/01/2016 - 21:31
User Badges:

Hi Sam,

Would it be possible to pass the dates in the string array as a parameter to the scipt, to make it easier for end users to change the dates?

Cheers and thanks,

Sam.

Mukesh Singh Sun, 12/25/2016 - 10:18
User Badges:

Hi Sam,


I used your method for holiday check but problem is that it always checks for only one date which comes first. I does not go to check the next dates in holidays variable.. Any idea why its not checking the other dates mentioned in holidays variable.


Regards,

Mukesh



Bill Mungaven Tue, 12/27/2016 - 12:11
User Badges:

I ran this in debug mode and it works perfectly; I didn't upload the script to my IPIVR server and try it there; I just single-stepped through it in the UCCX editor.

Did you use Sam's script exactly as-is from the ZIP file or did you make any changes to it? The script is looking for the date in the form MM/DD/YY which worked perfectly in my case. If you change the year to YYYY, the script won't work (i.e. 12/27/16 will work where 12/27/2016 won't work). I don't know if the script or UCCX server automatically adjusts to locales that use DD/MM/YY. I'm in the US so I didn't test this.

It sounds like you might be missing the Goto NEXT_HOLIDAY statement in the false branch of IF(sTodaysDate == sHoliday) step since it's not checking past the first array element.

Can you post your script or screenshot of the check holiday portion so we can take a look at it?

Did you try single-stepping Sam's script in the UCCX editor window?

Bill

Nelson Alonso Wed, 07/23/2014 - 07:46
User Badges:

Silly question here, what is this step for

Set holidays_iterator = holidays.iterator

 

Isn't the value of the holidays_iterator already set to com.cisco.util.EmptyIterator.iterator?

 

Thanks,

Nelson

Vikram Kachale Mon, 10/06/2014 - 14:05
User Badges:

Hi Anthony,

I am using your method to pull holiday in my script but I am failing at below step,

is_holiday = Call Subflow(SCRIPT[holidays.aef], is_holiday) 

Could you please attach screenshot of this step?Thanks!

I am attaching my both scripts here if you wanted to see how it is configured.Thanks!

 

 

 

 

Attachment: 
Mohamed Shameer... Tue, 01/29/2013 - 09:32
User Badges:

Thanks Andrew


Thanks for the Script and xml file.

I tried many samples here on the forum, this one worked like charm


Regards

shameer

stavropouloss Mon, 06/17/2013 - 02:55
User Badges:

Can someone help me with this script? According to the reactive debug I'm doing it seems that Get XML Data step doesn't work correctly. I see that after getting the data from the XML file it adds the TEXT in front of everything and also there's some data missing as a result, with the closedForHoliday variable to be always null. I'll upload a screenshot, along with the script and xml file I've made.


What am I doing wrong?


Thank you for the script.

Gergely Szabo Mon, 06/17/2013 - 02:57
User Badges:
  • Green, 3000 points or more
  • Community Spotlight Award,

    Member's Choice, December 2015

Hi,

please do not resurrect old threads, open a new one and refer to this.

There's nothing wrong with TEXT[etc etc], it's just a human readable representation.

It looks like a problem with your XPath query. Try this:

//Holiday[DayMonth='"+todaysDate+"']/Target

G.

stavropouloss Mon, 06/17/2013 - 03:51
User Badges:

Thank you for your reply. You were right! just changed the path and now it's working. Thank you.


But you think it's better to open new threads for asking same things again and again whithout the guy who provided the correct answer never know it or just ping the guy with a reply and keep the whole information for the next friend who need help gathered in the same post at the same time?

Gergely Szabo Mon, 06/17/2013 - 03:54
User Badges:
  • Green, 3000 points or more
  • Community Spotlight Award,

    Member's Choice, December 2015

How can I create a holiday schedule in my CCX script so calls go to voicemail on holidays instead of going into the queue? 

This was the original post. It's not related to your particular problem.

You attached everything (script, XML file, screenshot) so it can be dealed with separately.

G.

stavropouloss Mon, 06/17/2013 - 04:20
User Badges:

I needed to do the same thing with the OP. I've read the thread and the reply that was marked as the "Correct Answer". This specific answer was not working for me so I asked for further assistance on the same subject. The kind of specific issue I had is irrelevant. I was trying to be descriptive in order to get an appropriate answer. 


Now it's pointless to argue about this. The scope of the support forum pages is to ask for or give help. How about staying on this instead of patronising the way other users interact with the forum?


Have a nice day.

Actions

This Discussion

Related Content