Building playbook scripts

You can access scripts from the playbook library.

About this task

Local scripts are available only in the playbook. In the playbook library, they are organized under Local Scripts.

Global scripts are available in every playbook. In the playbook library, they are organized by object type. You see only the global scripts whose object type is compatible with the playbook's object type. You can also access global scripts from the Scripts tab on the Customization Settings window.

An input script is available only from its sub-playbook or function. For more information, see Input scripts.

Note:

Unlike workflows, playbooks do not have post-processing scripts for functions. To access the function outputs in the playbook, or to set a property value, in the Playbook schema, select playbook > functions > results and select the objects that you want to use. If you choose to manually code the script objects directly in the script editor, see Playbook operations for scripts for more information about using playbook keywords in your script.

Procedure

  1. In the playbook library, click the scripts () icon.
  2. To create a new script, follow these steps.
    1. Click Create Script to open the script editor.
    2. Provide a name, description, and scope of the script.
    3. Click View playbook schema to view the objects that you can add to the script.

      Alternatively, you can code the script objects directly in the script editor.

    4. In the Playbook schema panel, locate the object or attribute that you want to add to the script and click the plus (+) icon to add the path to the script editor.
    5. Click Run to iteratively test the script.
    6. When you are finished creating the script, click Create.
  3. To use an existing script, follow these steps.
    1. Locate the script that you want to use.

      To view more information about the script, select it to open the Script details window.

    2. Add the script to the playbook by dragging it to the canvas, or click the (+) icon.
  4. To manage existing scripts, choose from the following options:
    1. To edit the script, open the Script details window and click the edit () icon.

      Editing a global script changes that script for all playbooks, rules, and workflows.

    1. To duplicate a script on the canvas, right-click on it, and click Duplicate node.
    1. To remove a script from the canvas, right-click on it, and click Remove.
    1. To delete a script from the library, select the script in the library, and click the Delete from library icon in the Script details window.

      When you delete a script from the library, the script is deleted from all playbooks, and any rules and workflows.