Cisco Support Community
Showing results for 
Search instead for 
Did you mean: 

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. If you'd prefer to explore, try our test area to get started. And see here for current known issues.

New Member

"Subroutines" in an UCCX script

My days as a former programmer are showing through. I always preferred structured code. So in that regard, does anyone have a mechanism for creating a pseudo subroutine inside a UCCX script? I realize that I can create a subscript and call it from my original script, but I really don't want to do that for the few lines of code I need to execute.

I have a few lines of code that I need to execute from various points in my script. I'm looking for a mechanism to allow me to "call" that from a point in my script and then return to that point.

I could set a string variable with a value that defines where I'm at within my script, and then use a switch statement based on that string variable with a bunch of goto statements that will return me to the proper point. What would be better is the capability to modify the destination of a goto statement based on the variable. Does anybody have any other suggestions?


Re: "Subroutines" in an UCCX script

You can use Subflow to call a particualr script or few lines of codes...

Hope this helps.


New Member

Re: "Subroutines" in an UCCX script

Thanks for the response. I knew I could do it with that command. I usually use that method when I have multiple scripts calling the same function, i.e. Hodliday Check, Validate User.

In this case, since I have a function that will only be used in this script but is required from several places in that script, I wanted to keep it internal. I just didn't want to code it several times.

VIP Super Bronze

Re: "Subroutines" in an UCCX script

Sadly you cannot reference a variable within the Goto step. The way you can do this within the same script is to set a variable, Goto the function, and then check the variable value at the end of the function to decide where to return to. You can use a Match step to evaluate that variable and have a different Goto step within each case.

You may also want to read up on Trigger Application method instead of using subflows. This was a great improvment introduced in CCX5+. My answer to another thread gave a crash-course explaination of why it's better:

Please remember to rate helpful responses and identify helpful or

Re: "Subroutines" in an UCCX script

In addition to the Call Sub-flow step you can also embed Java code into your script. There is a step called 'Do' that will allow you execute Java directly. If you want to execute several statements, define locally scoped variables, & do other basic things you can use the curly braces {} to encapsulate the Java like you would a function.

Just be aware that the scope rules of Java apply. Any variables you define inside the {} are local and get destroyed upon exiting. You can reference variables you've created in the variable pane.

Please help us make the communities better. Rate helpful posts!