Scripting Best Practices

  • 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.
  • Use the Note action and the Annotation action 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 Snippet actions using two forward slashes (//).
  • 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—gets 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.