Dynamically Build a prompt Collection

Based on data we are getting back from an API we want to dynamically create the menu choices. For example if we get 3 items back we would like to dynamically play something like this. For X press 1 , For Y press 2 For Z press 3. Using expression editor can you dynamically populate a Prompt Collection? Or do you have another idea on how to do this.

THanks

AG

Yes you can dynamically populate a prompt collection. You can build a prompt collection using a the MakeList function. You can also add items to it using the AddItem or AddItemAt functions.

Note that you cannot dynamically create menu choices. You can tell your caller to only press 1 or 2, but menu choice 3 is still enabled. If you wanted to prevent them from using menu choice 3, make it a task with the 1st action to decide if the choice is ok to use. Earlier in your flow when you were deciding what choices to tell the customer about, create flow level variables to keep track of which choices are enabled or disabled; evaluate those variable(s) in the task and if it shouldn't be used you could optionally play a message to the caller before transferring back to the menu.

Thanks Melissa,

One more follow up can a prompt collection be played from the input tool all at ounce? To Clarify let's say it contains three members

Thanks

AG

You would need to use a loop action to play each prompt. Task.collection is the prompt collection for this example.
For loop count use the expression Count(Task.collection)
The play audio action is using the expression ToAudio(Task.collection[Task.index])

Gotcha thanks and have a good weekend.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.