cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements
339
Views
25
Helpful
5
Replies
Highlighted

[SOLVED] Question Regarding Formatting of the "If" Step in CCX Editor

Hi All,

 

I have been asked to edit our existing CCX script, that I wrote by pulling together various examples without any formal training on the subject and I need a little bit of help with writing an IF step.

 

We are running CUCM version 10.5.2.13901-2 and UCCX version 10.6.1.10000-39.

 

My script, currently has a bunch of nested IF steps to determine the CSQ the call is assigned to based on what the calling number starts with (below) but there is a small error with this.

 

01.PNG

The condition string for one of these IF steps is:

CLID.startsWith("0164545") || CLID.startsWith("057932774") || CLID.startsWith("05261898") || CLID.startsWith("45") || CLID.startsWith("74") || CLID.startsWith("98")

 

The problem is that some of our logged out extensions being with 45 i.e. 45123 so some calls are being routed incorrectly to these CSQs.  I am looking for a way to check for the length of the CLID variable but I cannot seem to find any API for it.  In my head something like CLID.length("4") might be used to look for CLID strings with a length of 4 to help my correctly filter these calls.

 

Ultimately, in this case I need to split this into stages where the pseudo code would be:

 

IF CLID.startsWith("0164545") || CLID.startsWith("057932774") || CLID.startsWith("05261898") 

THEN do X

IF CLID.startsWith("45") || CLID.startsWith("74") || CLID.startsWith("98") AND CLID.length("4")

THEN also do X

ELSE do Y

 

Could someone help me with the formatting of this or point me to an API?

 

Cheers,

 

Gordon

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Enthusiast

Re: Question Regarding Formatting of the "If" Step in CCX Editor

Correct, CLID.length()>4 will return true for 45123 but false for 4512.
CLID.length()==4 will check if the length is equal to 4, and return true if it is.
Yes, CLID.length()!=4 will return true if the length is not equal to 4.

View solution in original post

5 REPLIES 5
Highlighted
Enthusiast

Re: Question Regarding Formatting of the "If" Step in CCX Editor

You're looking for CLID.length() >4 

 

So, it would look something like:

 

((CLID.startsWith("45") || CLID.startsWith("74") || CLID.startsWith("98")) && CLID.length() > 4)

Highlighted

Re: Question Regarding Formatting of the "If" Step in CCX Editor

Thanks for the response Brian, that is very helpful.

 

I'm assuming the string of CLID.length() >4 is looking for length of more than four so that 45123 would register as TRUE and 4512 would register as False?

 

If that's the case would CLID.length() =4 look for length of exactly four so that 4512 would register as TRUE, while 45123 would register as FALSE, essentially reversing the results from above?

 

One final question.  Is there a NOT operator for this? Say, something like CLID.length() !=4, which would register 45123 as TRUE as it has 5 digits and 4512 as FALSE, given that it has 4?

 

Cheers,

Highlighted
Enthusiast

Re: Question Regarding Formatting of the "If" Step in CCX Editor

Correct, CLID.length()>4 will return true for 45123 but false for 4512.
CLID.length()==4 will check if the length is equal to 4, and return true if it is.
Yes, CLID.length()!=4 will return true if the length is not equal to 4.

View solution in original post

Highlighted

Re: Question Regarding Formatting of the "If" Step in CCX Editor

Thank you so much Brian.  I couldn't have asked for more.

 

All the best and have a great holiday period.

Highlighted
VIP Mentor

Re: Question Regarding Formatting of the "If" Step in CCX Editor

When I was first learning UCCX, I picked up a beginner's book on Java. A lot of the syntax in a script, but not all of it, is Java. The whole language in the Editor is called Editor Expression Language, and is based on the Java programming language. You can think of it like a higher layer on a cake, with Java being the foundation. Things like objects, methods, and properties are good to know, as well as variable types like null, int, String and boolean

For instance, knowing that comparing a String literal to a String variable like this: (name == "Anthony") is dangerous in Java, because if name is actually null, then the comparison fails. You would need to do "Anthony".equals(name) to be safe.

Anyway, read about Java, and it should help you out.

Alternatively there are the Programming guides from Cisco, but I think they are more like a reference material than a learning material.

https://www.cisco.com/c/en/us/support/customer-collaboration/unified-contact-center-express/products-programming-reference-guides-list.html

Anthony Holloway