I am working on a queue loop that will cycle through different prompts for a menu item. I have these Prompt variables.
And then I have queueLoopCount = 1
I have the queue loop incrementing by 1 at the end and then resetting to 1 when greater than 4.
For my menu, I tried to make the prompt "HoldMsg"+queueLoopCount.
At the moment, nothing really happens when it hits the menu... Not quite sure how to concatenate a variable name in place of a variable.
Solved! Go to Solution.
I did a search and found this post that is pretty similar to what you ask about. https://community.cisco.com/t5/contact-center/uccx-script-set-variable-value-with-a-set-step/td-p/2852119
Per it you might get it to work if you set the menu prompt to this P[HoldMsg + sQueueLoopCount]. However I’m not sure if this would work as there is no variable named HoldMsg.
What you could do is to put a switch step before the menu and look at the value of the loop counter and have a out branch per value. In each branch you define the content of the menu prompt variable with the name of the actual sound file to play. For example for loop count 1 set pMenuPrompt to P[1520-extended.wav] and so on. In the menu then set pMenuPrompt as the value for what to play. With this you should be able to drop the 4 prompt variables. If you for some reason want to keep them I guess you should be able to use them on the switch out branches to set the pMenuPrompt to HoldMsg1 and so on. Either way I recommend you to do a reactive debug to see what the variable pMenuPromp is literally set to so you’re sure it works as intended. It must point to an actual name of the sound file that you have uploaded into the prompt directory.
I assume you are incrementing a Integer. Set a String = your Integer. Then you can use the [Holdmsg] + String to build your new variable name that you want played.
Int - iQueueLoop
Str - sQueueLoop
Set sQueueLoop = iQueueLoop
Play Prompt = "HoldMsg" + sQueueLoop
Thanks for the response. My script is continuing to skip over the prompt despite corrected casting issue that I had.
I have verified HoldMsg1 through HoldMsg4 are a prompt variables.
I have tried the following...
After copying the integer queueLoopCount to string sQueueLoopCount is set
"HoldMsg" + sQueueLoopCount
I also tried building the string testString and made it equal to "HoldMsg" + sQueueLoopCount and the using testString as the prompt.
It seems as if it is expecting the Prompt name only. I tried to use String.valueOf(testString) and that didn't seem to work either...
Here is my queue loop.
Here are my prompt variables.
These variables get populated by the script...
Just to make sure there wasn't anything wrong with the prompts, I changed the menu to reference the prompt variable and it worked fine.
The prompts are getting populated...
Here is what I have for the menu...
It still skips over the menu... I could try to maybe set the HoldMsg# to a String and populate the Menu Prompt with P["HoldMsg" + sQueueLoopCount] ?
For your reference I had a look at one of our scripts and took a screenshot.
It's not a menu step, but the workings of this is the same. Please note that we do not use Prompt variables, we define the name of the prompt file with the above combination of string variables and a constant part.
With your setup what I think you need to do is something along with this.
Aka you set define a prompt variable for the prompt in the menu step and then before this step you set this variable to the wanted value based on the counter. For you it would be something along with this.
Please note I have not tested this out, just threw it together to get the screenshot. There are quite likely better and smarter ways to do this, but AFAIKT it should get the job done.
Let me know how it went for you?
Thanks for going through this in detail. I updated my script with your recommendation. I'm still having the same issue, but I think I have a better understanding. I think this maybe a limitation of the scripting language...
When I set sMenuPrompt = "HoldMsg" + sQueueLoopCount, it literally sets sMenuPrompt to HoldMsg1 on the first run of the loop.
On the next step, pMenuPrompt = sMenuPrompt, pMenuPrompt is then set to the literal String value HoldMsg1.
So, with UCCX scripting we are literally building the string that matches the variable name, but there doesn't seem to be a function that will extract the value of the variable when given the variable name as a string.
I don't believe that UCCX has a string type array, which would be the best solution. I think I might be able to rename the file names of the .wav files and then logically build the filename in a Prompt variable. Alternatively, I think I might be able to use the DOC variable, but I'm trying not to over complicate things, but my guess is that the above approach may not be possible due to the scripting limitations.