Playbook operations

The playbook operations apply only to those scripts used with the graphic playbook designer. The playbook operations are not available when you create a script in the Scripts tab.

The playbook keyword allows access to function results and ability to store and retrieve arbitrary property values.

The playbook keyword can access data in the current instance of the playbook only and is typically used in a local script. For an overview, see Global and local scripts.

Type playbook. in the script line to see the available operations.

Operation Description
inputs.<field_name>
Accesses the inputs of a manually activated playbook or a sub-playbook.

Inputs are read-only and cannot be modified. However, you can take the value and change it for use in the script, as described at the end of the table.

functions
Accesses the results of functions that were previously run in the playbook. The results are accessible by the function output name. Use the following property reference, where output_name is the name of the saved output of a function.
playbook.functions.results.<output_name>

Function results are read-only and cannot be modified. However, you can take the value and change it for use in the script, as described at the end of the table.

subplaybooks.results.<output_name>
Accesses the result of a sub-playbook for use in the parent playbook. Results are read-only and cannot be modified. However, you can take the value and change it for use in the script, as described at the end of the table.
properties
Accesses data that was previously entered by playbook.addProperty. Use the following property reference, where propertyName is the name of an existing playbook property.
playbook.properties.<propertyName>

The property reference can be used interchangeably with workflow.properties.<propertyName>.

addProperty
Adds or updates playbook properties. It can be any value that you need to reuse within the playbook. Use the following command, where propertyName is any name you choose, but must be unique. The <propertyValue> must be a Python dictionary.
playbook.addProperty(<propertyName>, <propertyValue>)

The command can be used interchangeably with workflow.addProperty().

results
Stores the result of the sub-playbook. It is used in the End point of a sub-playbook. The results are stored in a dictionary as shown in the following example.
playbook.results = {dictionary}

The sub-playbook’s result is a required field in sub-playbook’s End point. If the sub-playbook does not have a result, use playbook.results = None.

The results and properties are dictionary and thus can be used with any Python way of using dictionaries. For example, playbook.properties.foobar['result1'] is the same as playbook.properties.foobar.result1. It can also be used as:
str(playbook.properties) 
str(playbook.properties.foobar)
The values from inputs, functions, and subplaybook.results are read-only and cannot be modified. However, you can take the value and change it for use in the script. The following command shows how to change the value for inputs. The new value is used within the script only and is not available after the script execution completes for that node. Any scripts that follow in the playbook see the original value.
playbook.inputs.number=playbook.inputs.number+1,