05-06-2021 06:58 AM
I am working on a queue loop that will cycle through different prompts for a menu item. I have these Prompt variables.
HoldMsg1
HoldMsg2
HoldMsg3
HoldMsg4
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.
05-07-2021 02:39 PM - edited 05-08-2021 05:19 AM
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.
05-06-2021 07:45 AM
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
John B
05-06-2021 09:56 AM
Hi John,
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...
05-06-2021 10:16 AM - edited 05-06-2021 10:19 AM
Can you please post a screenshot of the prompt setting on your menu object in your script? Also please post a screenshot of the applicable variables definition.
05-06-2021 10:34 AM
Hi Roger,
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.
05-06-2021 10:54 AM - edited 05-06-2021 11:09 AM
Change your menu prompt to be P["HoldMsg" + sQueueLoopCount].
Also do a reactive debug of the script and check what the variables are set to during run state and what happens in the menu step.
05-06-2021 12:35 PM
Hey Roger,
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] ?
05-06-2021 01:12 PM
What do you mean that it skips the menu? I thought your issue was that it did not play the prompt in the menu. Does the script not get to the menu step.
05-06-2021 01:22 PM
05-07-2021 03:49 AM
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?
05-07-2021 06:59 AM
Hi Roger,
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.
05-07-2021 09:04 AM - edited 05-08-2021 01:37 AM
You can definitely rename the sound files and use the same type of setup that we do in the first screenshot. If you do that you would need to define the prompt on the menu like this. P[“HoldMsg" + sQueueLoopCount + “.wav” if you would name the files HoldMsg1.wav and so on.
I think that there actually is an array type of variable.
05-07-2021 02:39 PM - edited 05-08-2021 05:19 AM
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.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide