LOOP

Executes a repeat branch condition a specified number of times. If you have ever called your phone or power company and they have asked you to, "Press 1 for x or 2 for Y..." and you fail to press the correct number, the loop occurs, telling you that you entered an incorrect number and to try again.

Supported Script Types

Generic Email Chat Phone Voicemail Work Item

Properties

Repeat
The number of times the loop will repeat before the OnFinished branch is taken.
CounterName
Name of a variable to receive the current Repeat count.

Branches

OnFinished
The script will follow this branch when the loop has occurred the number of times specified in the Repeat property.
OnRepeat
The script will follow this branch up to the number of times specified in the repeat property.

Tips and Tricks

  • The Repeat branch will be executed as many times as is indicated by the Repeat property. For example, if Repeat is 5, exactly 5 iterations of the actions following the Repeat branch condition will execute.
  • After the iterations set in the Repeat branch have been completed, the next time LOOP is executed, the Finish branch will be triggered.

Phone Script Example Using LOOP

After the script is triggered, VOICEPARMS sets the text-to-speech voice and HOURS sets the hours of operation (using the Hours of Operation profile). When the script reaches the MENU action, a message is played, asking the caller to press 1 to request an agent. If 1 is not pressed in 5 seconds (set in the MENU Timeout property), then the LOOP will be triggered, at which time a message will play, telling the contact to try again. The loop will occur three times, and on the fourth time, the loop will follow the Finished branch instead of the Repeat branch. On the Finished branch, a different message will play, telling the contact to call back later and then hangs up the call.

Would you like to download this script?

In a simple event, when a call is placed on hold a loop will occur in which music plays, followed by a message, followed by music and another message and so on until the call is taken off hold.

Would you like to download this script?