Loop

This help page is for Desktop Studio. This information is also available for CXone Studio.

Executes a repeat branch condition a specified number of times.

The Repeat branch is 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 is triggered.

For example, in an IVRClosed Automated phone menu that allows callers to interact through voice commands, key inputs, or both, to obtain information, route an inbound voice call, or both. menu, you can add a Loop to have contacts try again if they press an invalid number. You can set up the loop to give contacts three tries before sending them to an operator.

Supported Script Types

The icon for a Generic script type - a rectangle with < and > symbols inside it.

The icon for the Email script type - a large @ symbol in a diamond.

The icon for the Chat script type - a chat bubble with an ellipsis inside (...), in a diamond shape.

The icon for the Phone script type - an old-style phone handset with curved lines indicating sound coming out of it.

The icon for the Voicemail script type - a symbol that looks like a cassette tape - two circles sitting on a horizontal line.

The icon for the Work Item script type-a piece of paper with one corner folded down and a bullet list on it.

The icon for the SMS script type - a smart phone with a chat bubble coming out of it.

The icon for the Digital script type - a computer monitor with a smartphone next to it.

Generic

Email Chat Phone Voicemail Work Item SMS Digital

Input Properties

These properties define data that the action uses when executing.

Property

Description

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

Result Branch Conditions

Result branch conditions allow you to create branches in your script to handle different outcomes when an action executes.

Condition

Description

OnFinished

Path taken when the Repeat count exceeds the specified number.

OnRepeat

Path taken while the current Repeat count is less than or equal to the specified number.

Script Example

This is an example to show how this action can be used in scripts. It is not intended to be a complete script. Additional scripting may be required.

fter the script is triggered, Voiceparams 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?