"Subroutines" in an UCCX script

Unanswered Question
Oct 15th, 2009
User Badges:

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?

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 5 (2 ratings)
robluechtefeld Thu, 10/15/2009 - 09:53
User Badges:

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.

Jonathan Schulenberg Thu, 10/15/2009 - 11:53
User Badges:
  • Super Bronze, 10000 points or more
  • Cisco Designated VIP,

    2017 IP Telephony

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:


Steven Griffin Fri, 10/16/2009 - 11:50
User Badges:
  • Silver, 250 points or more

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.


This Discussion