cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
805
Views
0
Helpful
4
Replies

Cisco UCCX 10.6 Java Scripting

jwright2
Level 1
Level 1

Hello,

 

I am currently trying to get a script setup for On Call purposes. I am not versed in Java and am having a hard time getting the Java end of the script working. Currently I have an XML file I am working with, below is a sample of it:

<Worksheet ss:Name="Schedule">
<Table ss:ExpandedColumnCount="34" ss:ExpandedRowCount="18" x:FullColumns="1"
x:FullRows="1" ss:DefaultColumnWidth="54" ss:DefaultRowHeight="15.75">
<Column ss:Width="108.75"/>
<Column ss:Width="145.5"/>
<Column ss:AutoFitWidth="0" ss:Width="94.5" ss:Span="31"/>
<Row>
<Cell ss:StyleID="s16"><Data ss:Type="String"></Data></Cell>
<Cell ss:StyleID="s16"><Data ss:Type="String">Position</Data></Cell>
<Cell ss:StyleID="s16"><Data ss:Type="String">Total: Paid hours</Data></Cell>
<Cell ss:StyleID="s16"><Data ss:Type="String">Wed, May 1</Data></Cell>
</Row>
<Row>
<Cell ss:StyleID="s16"><Data ss:Type="String">Jane Doe</Data></Cell>
<Cell ss:StyleID="s16"><Data ss:Type="String">Service Desk On Call</Data></Cell>
<Cell ss:StyleID="s16"><Data ss:Type="Number">126</Data></Cell>
<Cell ss:StyleID="s20"><Data ss:Type="String">On Call</Data></Cell>
</Row>

 

The bold text are fields I am currently trying to work with. I've already got the date formatted correctly in the script I just need help on how to write the following items using Java:

1. Searching the XML file for the matching date. ex: If today is Wed, May 1 find what row/cell Wed, May 1 is in.

2. Checking the corresponding cell in each row for "On Call" ex: Wed, May 1 is in Row 1, cell 4 so check the 4th cell in each row.

3. If they are "On Call" checking the second cell in that row for if they are on the "Service Desk"

4 If they are on the "Service Desk" checking the first cell in that row for their name: ex "Jane Doe"

 

Any help on this topic would be greatly appreciated.

4 Replies 4

James Hawkins
Level 8
Level 8

That XML file looks crazily complex compared to most XML files commonly used with UCCX.

How was it generated and do you have to use that format?

 

Thanks for the quick response and I agree it's a rather complex file for what I am trying to accomplish. The XML file was exported from Microsoft Shifts which is where our on call schedule is now located. I had an easier format setup and working but they want it to use the data exported from Shifts now in a effort to incorporate it more and have only one place they update the schedule, however the coding involved in parsing though it to incorporate it with CCX has proved to be quite difficult.

I am wondering whether it would be better to try integrating with MS Shifts using the REST based API rather than trying to parse an exported XML file?

The Shifts API seems very new and is documented at the link below.

https://docs.microsoft.com/en-us/graph/api/schedule-list-shifts?view=graph-rest-beta&tabs=http

 

 

janinegraves
Spotlight
Spotlight

Hi - first of all your xml isn't complete, you're missing the closing </Table> and </Worksheet> tags.
I don't know UCCX, but I do know XPath parsing. 

Your data better always be coming back with the same number of rows in the same order, else I don't see any way to know where the data of interest is.

Anyway, these are the XPath expressions for the first 2 bolded items you asked about.

Wed, May 1 is:  /Worksheet/Table/Row[1]/Cell[4]/Data

Jane Doe is :  /Worksheet/Table/Row[2]/Cell[1]/Data

 

Note that in Notepad++ you can use the Plugin Manager and install XML Tools.
There you can go to Plugins > XML Tools > evaluate the xpath expression and test things out, very useful!

Are you going to be coding this in Java? Or JavaScript? Maybe I could  help.