cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1001
Views
5
Helpful
2
Comments
steakandeggs
Level 1
Level 1

So I want to organize my xml files in UCCX so that I can call parent data or sibling/peer data from the child of the parent. This makes it much easier to format xml files so that they easier to read and also more useful.

 

Lets take the following:

 

<settings>
<queue name="potatoes">
<number>1234</number>
<queue name="bacon">
<number>5678</number>
</settings>

Say you know the number and need to get the name of the queue. I've seen a couple very convoluted ways to do this by looping through the xml file many times. There is an easier way. Say you are calling the bacon queue by dialing extension 5678. How can you get bacon? Check it out: 

 

"/settings/queue/number['5678']/../@name"

This returns "bacon" because ../ gets the parent. As you may see, this makes XML files much, much easier and valuable.

 

So of course let's make this a little more useful and make a String variable, DNIS, and assign it the value 5678. Watch out for the single and double quotes. The script editor uses a horrific font which makes it very very hard to see what is actually typed in.  

 

"/settings/queue/number['" + DNIS + "']/../@name"

This also returns bacon. As all things should.

Comments
James Hawkins
Level 8
Level 8

That is really interesting - I feel a lab session coming on.

Can you retrieve peer info in this way? - for example could you get color from the XML file below?

 

<settings>
<queue name="potatoes">
<number>1234</number>
<color>blue</blue>
<queue name="bacon">
<number>5678</number>
<color>red</color>
</settings>

 If yes what would be the syntax?

steakandeggs
Level 1
Level 1

I don't often check this forum. Hopefully this answer is still useful to you even though it is a few months late. Yes of course you can get blue:

 

"/settings/queue[@name='potatoes']/color"

 

I believe that is the syntax to return the value of 'color' though I haven't tested it.

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: