Sunday, 28 April 2013

UCCX Script for Checking Holiday

I am going to share a vey common scenario that many UCCX customer demands in there scripts.This is how incorporating a holiday check in there scripts as a subfow.

As this scripts are commonly used by all the scripts so better to create it as a separate individual scripts and to return a Value (either true or fasle).True in case it found a holiday and flase if it doesn't find a holiday.

To acheive this the best option is to use the XML document  for holiday the sample document that i used is as below  and name it as per your own ( I named it Holiday.xml)

<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- m/d/yyyy NO LEADING ZEROES IN DATE NUMBERS !!!! -->
<Holidays>
       <Holiday1>2/2/2013</Holiday1>
       <Holiday2>4/26/2013</Holiday2>
       <Holiday3>4/27/2013</Holiday3>
 </Holidays>


Remember  not to put any leading "0" in mentioning the date.

Now lets get a date form the system to get a date from the system create a date (Lets say todaysdate) variable and using the create java object step get the current date from the system,The constructor  for this is java.utils.Date().

It will look like as below


Now next step is to use the execute java method to get the date,month and year in a separate variable ( an integer type variable) .





Do the Same with separate variable for Month and day.

Once you get the variable in integer format  change then to string format using the execute java method as shown below:



 Now once you get all the value in string format arrange them in the daye format ( i used mm/dd/yyyy)
so to scheive this use the set step,




Now using the get XML data get the list of holiday from the XML document created previously and assign it to a variable (type string)


Now using if statement comapre the two value  (one you received from the system an done you rceived from the XML document and put a logic or set a boolean variable to true if condition matches and use it for the Main script.





No comments:

Post a Comment