Input scripts
The input script can dynamically retrieve a value then set the input of a function or a sub-playbook to that value.
An input script can read incident values only. It cannot complete activities such as changing incident values and adding artifacts.
Follow the procedure to write a script that provides input to a function or a sub-playbook.
- Use Python 3 to write the script that retrieves the values.
- Provide a value to the function, use the
inputs.<field_name>
keyword, where field_name is the function field’s API name. If you do not know the field name, typeinputs.
to have the type-ahead feature display the field names.The script ignores any attempt to set the value of anything other than input fields, and it does not issue an error message. It also ignores any attempt to create objects, for example,
incident.createTask()
.
The following example is a simple script that retrieves the ID of the incident and places it into
a field called incidentID
.
inputs.incidentID = incident.id
You can use the following code to access the output of a function started earlier in the
playbook.
playbook.functions.results.<output_name>
You can use the following code to access a property value that was added by a script started
earlier in the playbook.
playbook.properties.<propertyName>
For more information, see Playbook operations for scripts.