Scripting Best Practices

The information on this help page applies to both Studio and Desktop Studio.

  • Change the Caption property of each action to uniquely identify it and what it does in the script. This makes it easier to read and understand the flow of a script. Additionally, the captions of some labels appear in reports, such as the IVR Press Path report. Having unique names makes the reports more useful. In Studio, the property is called Add caption.
  • Use absolute paths when possible. They are clear and describe exactly where a file is located. Absolute paths are widely supported in Studio. However, some actions may support only relative paths. If you try an absolute path and it doesn't work but a relative path does, use the relative path. If you know both types work, it's best to use the absolute path.
  • Use the Noteaction and the Annotationaction to add comments to your script. You can use them to explain the flow of the script, the script's purpose, and the reasoning behind the scripting logic. You can also add comments to Snippet code in Snippetactions using two forward slashes (//). (Action help pages in StudioNoteaction; Annotationaction; Snippetaction.)
  • All variable names should be meaningful.
  • Connect the Default branch condition for every action. This helps avoid issues when something unexpected happens and the script can't take any of the other branches. For actions that have it, relying on the onError branch condition may not be enough. There could be situations that occur that aren't errors and aren't handled by the other branch conditions. If you don't have a Default branch and something happens that's not covered by the other branches, the script and the contact get stuck at that point in the script.
  • Use underscore characters ( _ ) instead of spaces in all file names.
  • Always use the ASSIGN keyword when assigning a value to a variable. When you use advanced search, you can quickly locate where a variable was created if you include the ASSIGN keyword. Without it, the search results show you every instance where the variable appears in your script.