cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
979
Views
10
Helpful
4
Replies

"Subroutines" in an UCCX script

robluechtefeld
Level 1
Level 1

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?

4 Replies 4

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

Hope this helps.

Baseer.

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.

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:

http://forums.cisco.com/eforum/servlet/NetProf?page=netprof&forum=Unified%20Communications%20and%20Video&topic=Contact%20Center&topicID=.ee6fe12&fromOutline=&CommCmd=MB%3Fcmd%3Ddisplay_location%26location%3D.2cd3f333

Steven Griffin
Level 4
Level 4

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!