Showing results for 
Search instead for 
Did you mean: 

UCCX 8 - Different prompts for different dates


Hi all,

Is there a structured way to play different prompts based on the different dates extracted from the holiday xml file? For example each/several date(s) [01/01/2011, 02/02/2011] would correspond to a particular prompt [1.wav] while other dates have their own prompts.



8 Replies 8

Anthony Holloway
Cisco Employee
Cisco Employee

I'd like to see your XML document.

Here's an example, not knowning anything about your data structure, or prompt repository:

Say your XML values looked like this:


When you search for it with the Get XML Document Data step, the value returned will be the String:


You could then easily convert the slashes to underscores, and prepend a directory on it for a valid prompt file name:

Play Prompt(--Triggering Contact--, "holidays/prompt_" + my_date.replace("/", "_") + ".wav")

That would play the prompt:


Hi Anthony,

Thanks for your suggestion.

I'm planning to use the standard Holidays.xml (uploaded in doc mngt) file and script which has the holidayID in it and return the holidayID value as well. So holidayID [1,2,3,4] returned would be playing prompt [a.wav] while holidayID [5,6,7] would be playing prompt [b.wav] and so on.


There's several thread talking about some changes required for this script to be used in UCCX 8 pertaining to java function and repository. Not too sure how this would impact.



Then you could just put the prompt letter in an XML node attribute:




As far as your solution not being supported in UCCX 8x, just make sure you are not reading and writing to the local C:\ of the UCCX server now.  If you are, convert your scripts to start reading and writing to the repository instead.  other than that, you should be fine.

You might also consider putting the relevant information along with the holiday using a separator, this of course would require a rewrite of anything fetching xml data but it works well and is simple to implement.



As you are fetching the dates from the xml list, simply split the string based on the semi-colon into a string array, [0] will be your holiday string, [1] will be the wav.

String [] * strArray = New String [2]

strArray = resultFromXMLFetchStep.split(";")

if (strArray[0] == strOfTodaysDate)

   Play Prompt (P[strArray[1]])


It should require only a few minor changes to your script without adding much complexity and one benefit to this approach is you do not need to alter your xml query paths, which simplifies some aspects in the script writing process.  That being said, I do prefer the format proposed by Anthony as I find it visually "neater", but either will work. Whichever approach you choose, make sure you are comfortable writing the relevant code.

Apologies if the syntax I provided is wrong or incorrect, I'm typing from memory, but it should be fairly close.

Tanner Ezell

Tanner Ezell

FYI to the readers:  Tanner's method, though valid, and creative, requires the use of method calls, which will not work in Standard.

Additionally, that is bordering on abusing the XML standard.  The whole point of XML is to mark up your data in a meaningful way.  Just be careful. 

The example Holiday script does things the hard way. There's no need to iterate through a list and do complex parsing if you structure the XML file a bit differently, putting the date in an XML tag you can search for. I wrote a generic State Manager toolkit a few years ago that manages day of week scheduling, holidays (with fractional holidays) and one-off closures or schedule operations, can tweak behaviors based on date, etc. It uses exactly this method. It actually runs on Standard as long as the XML file is strictly correctly formatted.

A very simple version of what you want might look like this:




Script steps:

1) Get the date, capture D[now] to a static variable, call it RightNow. Could reference D[now] directly the whole time but I was always paranoid about scripts running over midnight boundaries.

2) Build a String DateString as follows: "Set DateString = RightNow.month + "/" + RightNow.dom + "/" + RightNow.year". As an aside, Date .month, .dom and .year variable fields are fully accessible without tripping the UCCX Standard licensing check.

3) Grab XML data using XPath as follows: "/SPECIALDATES/SPECIALDATE[@Date='" + DateString + "']". Store the result in a String DateResult.

4a) If DateResult == "" || DateResult == null, then today isn't a special date. The XML parser may return either for no-data result, it changed between UCCX versions.

4b) If DateResult isn't empty, you'll have the string "Thanksgiving" or similar and can toss that right into Play Prompt.

I quite like this this approach, thank you for sharing that Jas


I said it was simple, not pretty and proper .

Tanner Ezell

Hi Anthony,


I have the attached xml file containing the holiday list. For example, Christmas contain date 12/24/2015, 12/25/2015, 12/26/2015. And Ied Mubarak contain date 07/17/2015, 07/18/2015. How can i create the If statement in a script that check if the current date is categorized as Christmas, play prompt MerryChristmas.wav? And if the current date is categorized as Ied Mubarak, play prompt IedMubarak.wav.



Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Recognize Your Peers