cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2062
Views
20
Helpful
12
Replies

Loop Counter to Cycle Through Prompts

justinhulsman
Level 1
Level 1

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.

1 Accepted Solution

Accepted Solutions

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.



Response Signature


View solution in original post

12 Replies 12

JohnBushong8071
Level 1
Level 1

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

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...

 

 

 

 

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.



Response Signature


Hi Roger,

 

Here is my queue loop.

Capture1.PNG

Here are my prompt variables.

Capture2.PNG

These variables get populated by the script...

Capture3.PNG

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.

Capture4.PNG

 

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.



Response Signature


Hey Roger,

 

The prompts are getting populated...

Capture1.PNG

 

Here is what I have for the menu...

Capture2.PNG

 

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] ?

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.



Response Signature


Hi Roger,
Sorry for the bad verbiage. When I do a reactive script it does hit the Menu object, but there isn't any audio that gets played. It just moves on quickly if I let it run by hitting the "continue" button.

For your reference I had a look at one of our scripts and took a screenshot.
image.png

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.
image.png

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.

image.png

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?



Response Signature


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.

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.



Response Signature


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.



Response Signature