cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements

475
Views
0
Helpful
5
Replies
putney_m
Beginner

UCCX Script Help

I have the attached script and I want to add a check for to see if today is a holiday and also an announcement while they are in queue for the estimated wait time. Can someone assist me with this?

 

Any assistance would be greatly appreciated. 

 

Thanks!

 

Michael 

5 REPLIES 5
Gergely Szabo
Advocate

Hi,

I see.

Alright, can you give me the UCCX version and license level (Standard, Enhanced, Premium)?

About the Holidays: do you want to keep the list of holidays in an external data source (e.g. XML file, database table) or is it okay if they are built into the script itself?

About the estimated waiting time announcement: do you have any specific requirement? Or is it okay to use what UCCX offers (per CSQ "Expected Wait Time")?

Thanks.

G.

Gergely, 

 

This is for a UCCX 8.5 Enhanced server. 

 

I think the best would be to have it reference an XML file that includes all the holidays. 

 

The Wait time would be fine to use the per CSQ"Expected Wait Time" that UCCX offers. 

 

Thanks, 

 

Michael 

 

Okay then, let's have an XML file. Do you need to have dates and hours, too or just dates? G.

Just dates would be perfect. 

 

Thanks!

Hi,

OK, let's use the following XML file as a database for our holidays. To make things more universal, there are two sections in this database, one for specific dates and one for recurring dates.

<?xml version="1.0" encoding="UTF-8"?>
<database>
<specificDates>
<date day="2014-10-16" note="Super Important day!" />
</specificDates>
<recurringDates>
<date day="10/16" note="John's birthday" />
<date day="12/25" note="Christmas" />
<date day="3/15" note="Hungarian Revolution of 1848" />
</recurringDates>
</database>

Create a new file, name it holidaydb.xml, copy and paste the above section. Finally, upload it into the UCCX Document Repository.

The script itself needs a few variables to make this working:

doc - type: Document - initial value: DOC[]

hmap - type: java.util.HashMap - initial value: new java.util.HashMap(2)

result - type: String - initial value: ""

First, let's take the actual date and insert it into the hmap variable. We can use the Do step with the following code block:

{
java.util.Date date = new Date();
String specificDate = new java.text.SimpleDateFormat("yyyy-MM-dd").format(date);
String recurringDate = new java.text.SimpleDateFormat("MM/dd").format(date);
hmap.put("specificDate", specificDate);
hmap.put("recurringDate", recurringDate);
}

Next, we create an XML document based on the file uploaded onto the Document repository.

doc = Create XML Document (DOC[holidaydb.xml])

Then use the Get XML Document Data step with an XPath expression to check for the specific date, saving the result in the result variable.

result = Get XML Document Data(doc, "//specificDates/date[@day='" + hmap.get("specificDate") + "']/@day")

We use an If step to check for the length of the value of the above variable. If it's longer than 0 then we know there's a match.

Similarly, we can check for recurring dates:

result = Get XML Document Data(doc, "//recurringDates/date[@day='" + hmap.get("recurringDate") + "']/@day")

Here's a screenshot:

G.

Content for Community-Ad