After the future removal of the classic playbook editor, your existing classic playbooks will continue to run, However, you will no longer be able to visualize or modify existing classic playbooks.
For details, see:
Add custom fields to your playbook
You can define and use your own custom fields for events — either globally or for specific event types — in a playbook. For example, you might add a custom field named Department and assign it a list of values for each department in your organization (for example, IT Ops, Sales, and Business).
Using custom fields in playbooks requires special coding.
Plan your naming convention carefully. Custom field names described here require additional special handling:
- names containing characters other than letters, numbers, or underscores (_)
- names starting with a space
Update and read custom field values
To update custom field values in containers, use the following code examples with the container.update API :
Update a custom field value
Example code to update a custom field value from a container.
outputs = {} # Write your custom code here... container = {"id": container_id} update = { "custom_fields": { field_name: field_value, }, } # Make the HTTP request success, message = phantom.update(container, update) assert success, message # Return a JSON-serializable object assert json.dumps(outputs) # Will raise an exception if the :outputs: object is not JSON-serializable return outputs
Read a custom field value
While not technically an update function, reading a custom field value also uses the container.update API.
Example code to read (get) a custom field value from a container.
outputs = {} # Write your custom code here... container = phantom.get_container(container_id) custom_fields = container.get("custom_fields", {}) outputs["field_found"] = field_name in custom_fields outputs["field_value"] = custom_fields.get(field_name) # Return a JSON-serializable object assert json.dumps(outputs) # Will raise an exception if the :outputs: object is not JSON-serializable return outputs
Save a playbook so can access it | Use keyboard shortcuts in the playbook editor |
This documentation applies to the following versions of Splunk® SOAR (Cloud): current
Feedback submitted, thanks!