Post-process script

The post-process script can change incident values, add artifacts, add data table rows, and perform the activities that a script in the Scripts tab can perform, with the exception of logs.

Use standard Python language. In the Language field, determine whether to use Python 2 or 3 to evaluate the script.

The scope and restrictions that apply to the scripting feature, as described in Configure Scripts, applies here too.

In addition, the post-process script has the following unique keywords that allow you to do the following:
  • Obtain the saved output from the script's function.
    results
  • Add or update workflow properties. This can be any value that you need to reuse within the workflow. Use the following command, where propertyName is any name you choose, but must be unique. The <propertyValue> must be a Python dictionary.
    workflow.addProperty(<propertyName>, <property Value>)
  • Access data previously entered by workflow.addProperty. Use the following property reference, where propertyName is the name of an existing workflow property.
    workflow.properties.<propertyName>

Note that inputs from the pre-process script are not available to the post-process script.

Tip: If there is an existing script or code that you would like to use in a pre- or post-process script, you can copy and paste from any script editor including the scripts in the Scripts tab.
You could have a unique name for the property workflow.addProperty("resultx", <some_dictionary>) so that it can be used later in the workflow. When the workflow completes, the workflow.property values are no longer available. However, you could use a script in the workflow to explicitly assign the property to the incident; for example:
if workflow is not None:
  desc = []
  for key in workflow.properties.keys():
    desc.append(str(workflow.properties[key]))
  incident.description = helper.createPlainText(",".join(desc))
Note: Make sure to review the list in Script considerations, which applies to the post-process script as well as the script feature.