Function input script
The function input script can dynamically retrieve a value then set a function’s input to that value.
A function input script can only read incident values. It cannot perform activities such as changing incident values and adding artifacts.
To write a script that provides input to a function, perform the following:
- Use standard Python language to retrieve values. In the Language field, determine whether to use Python 2 or 3 to evaluate the script.
- 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, type the
inputs. keyword and the type-ahead displays 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 is a simple example of a script that retrieves the ID of the incident and places it
into a function field called incidentID
.
inputs.incidentID = incident.id
You can use the following code to access the output of a function invoked earlier in the
playbook.
playbook.functions.results.<output_name>
You can use the following code to access a property value added by a script invoked earlier in
the playbook.
playbook.properties.<propertyName>
For details on using the playbook keyword, see Playbook operations.