Scripting in Studio

Scripts are an essential part of managing your contact center. They allow you to customize routing from the start of an interaction to the end. Your contact center may have many different scripts, each one addressing a different aspect of routing. Some scripts are required, while others are optional. The exact number and kind of scripts that you need depends on the applications and features you use and the kinds of interactions you handle.

Scripts can range from very simple to quite complex. Simple scripts don't require much knowledge of scripting or coding. The more complex scripts can require custom script code. The following image shows an example of a script.

Refer to the scripting best practices to ensure you're following all the recommended guidelines.

Script Media Types

Studio supports the same media types as CXone, including phone/voice, chat, SMS, and email. When you create a script, you're prompted to select the media type. The media type must match the type of routing the script handles. The script media types in Studio are: 

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

Most actions work with any script type, but some actions only work with specific script types. For example, ASRClosed Allows contacts to respond to recorded voice prompts by speaking, pressing keys on their phone, or a combination of both. actions only work with phone scripts. Actions that aren't compatible with a certain type of script won't appear in the Tools tab of that script. If an action from the Framework tab is not compatible with the script type you're creating, Studio displays an error message.

Script Components

In Studio, scripts are made up of connected blocks called actions. Each action serves a specific purpose in the script, such as creating a menu of choices, playing an audio file, or requesting the next available agent. Most actions have a set of properties that must be configured to define the behavior of the action for the specific scripts you're creating. Properties include things such as choosing skillsClosed Used to automate delivery of interactions based on agent skills, abilities, and knowledge, setting variables, and selecting an audio file to play.

The flow of your script is defined by how actions are connected. You can create branches in your script if there is more than one possible outcome of an action. You can see the flow of the script on the canvas in Studio. The connections between actions are shown with lines and arrows.

Prompts are a common component of many scripts. They're audio files that a script can play when you need to offer the contact a choice or give them information. For example, 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 uses prompts to let contacts know their options for proceeding with the interaction. This could be messages such as "For Sales, press 1. For Support, press 2." You can also use prompts to give the contact information, such as your organization's hours or the contact's current account balance.

Online help for Studio actions is available. You can scroll through the list of available action help pages or search for the name of an action using the search bar. You can also access help directly from Studio by selecting an action on the script canvas and pressing F1 on your keyboard.

Script Templates and Examples

Studio offers script templates for some features and applications in CXone, such as call suppression in Personal Connection. Script templates are in the Available Templates section of the Create New Script window.

The online help contains other scripts that you can base your own scripts on. Some products or features in CXone require scripts to work. The online help for those products provides information about those scripts. Additionally, the online help pages for many Studio actionsClosed Performs a process within a Studio script, such as collecting customer data, playing a message or music, or routing a contact to an agent. provide script examples. These examples show how you can use a particular action in your scripts.

Script Version Management

You can manage the versioning of your scripts by developing a naming convention. A common naming convention is to include DEV or PROD at the end of the script file name. These additions help you identify a script as being in development or production. You can include other information such as dates or version numbers, if it fits your organization's requirements.

When you need to change the name of a script, such as when moving from development to production, you must make a copy of the script using Save As and give it a new name. Studio doesn't allow script names to be changed after they're saved. After you put a script into production, you can deactivate the older production and development versions if you want keep your script folders uncluttered. If you ever need to use them again, you can reactivate them.

Scripts have two types of historical versions in Studio. There are the individual files that accumulate as you move scripts in and out of development and production. Studio also maintains a certain number of previous versions of each script file. Each time you save a script file, Studio adds a new version to that file's history. You can revert to previous versions of a script file if needed. The number of versions that Studio keeps is configurable.

Because another version is added each time you save a script, you could completely replace all of the saved versions of that script during a session of working on a script. You may want to create a copy of the script before you start working on it, especially if you're making significant changes. This way, you can refer to it or completely revert back to it if needed. Name the copies so that you know which version it is and why you kept it.

Never edit a production script. Saved changes go into effect immediately. If a change causes a problem with a script, it could impact your contact center's ability to function. If you need to make changes, use Save As to create a copy of the script and name it to indicate that it's in development. Only put it into production when it's fully tested and ready.

Custom Coding with Snippets

Simple scripts don't require custom coding. For more complex scripts, you can include custom coding using the Snippet action. This allows you to insert code into your script anywhere you need to enhance or expand the capabilities offered by the other Studio actions in the script. In some cases, Studio actions or entire CXone applications require Snippet code to work properly.

Studio supports an in-house coding language called Snippet. This language executes server-side and compiles into MSIL (Microsoft Intermediate Language) just like C# and Visual Basic .NET. A complete reference guide to Snippet is available.

Notes and Annotations in Scripts

Studio offers several ways to add comments to your scripts. This is an important step that can help ensure that you, and anyone who works in the script after you, understands the script later.

Studio has two actions you can include in your scripts, Note and Annotation. Neither of these actions affect how the script works. They are informational only. The difference between the actions is: 

Another option available for making notes in a script is changing the caption on the actions in the script. In the properties of each action is a Caption field that lets you change the name of the action that appears on the canvas. You can use this to name each action with a word or short phrase to remind you of that action's purpose in the script. For example, you could change the name of a Snippet action to indicate what the code that it contains does. For example, you can name each Play action in your 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 with the name of the audio file or prompt that it plays.

Key Facts about Scripting in Studio

  • The Script Errors tab shows any warnings and errors related to your script. You can use this information to help troubleshoot issues with scripts.
  • Studio has some script APIs you can use to programmatically open and save scripts. This requires advanced scripting skills.
  • You canimport and export scripts as XML files.
  • Studio does not allow scripts to be renamed once they're saved. If you need to change a script's name, you can use Save As to create a copy with a new name, then deactivate the old script or move it into a separate folder so it's out of the way.

  • You can view previous versions of a script in two places: 
    • In Studio, right-click on the script in the Browse tab (View> Browser) and hover over the History option.
    • In CXone, click ACD > Scripts. On this page, you can also revert a script to a previous version.
  • You can schedule scripts to run using the ACDScript Scheduling option in CXone.
  • On the ACD > Scripts page in CXone, you can spawn a script with temporary custom parameters that the script uses as variables.
  • To prevent a script from becoming too large and complex, you can break it into multiple smaller scripts and link them using Runsub or Runscript actions.