You can access objects when writing a script. These objects reflect the action object data and some contain helper methods. Note that the script feature can access all the objects available as Object Types, as well as additional objects.
When writing a script, type the object, such as "incident." or "task.", to display the available field values. To see the custom fields, type "incident.properties.".
You can write a script from the Scripts tab or from the Playbook designer. If creating a script from a playbook, you can choose to have that script available to the playbook only and is not listed in the Scripts tab.
Perform the following:
- If in the Scripts tab, click the New Script button. If in a playbook, click the script icon in the library then click Create script.
- If you clicked Create script from the Playbook designer, choose the Script scope, which is Global to have this script available to all playbooks and from the Scripts tab, or Local to have this script available to the playbook only.
- Enter a descriptive name for the script.
- Provide a description of the script's purpose.
- Select an object type. If selecting Data Table, you must also select the specific data table.
- Choose a language. Python 3 is the default, but you might want to write a script in Python 2 for backwards compatibility. For more information, see Python 2 and Python 3 differences.
- Review the following sections, which describe the objects accessible by the script and the operations that can be utilized.
For local scripts created with Playbook designer, also see Playbook operations for operations unique to the playbook script.