Create custom fields to filter Splunk SOAR (Cloud) events

Create custom fields that can be added to containers in Splunk SOAR (Cloud). You can use custom fields to match your business processes, or to help filter containers, events, or cases for extra attention. 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).

Custom fields are searchable. For more information on using the search feature, see Search within Splunk SOAR (Cloud) in Use Splunk SOAR (Cloud).

Using custom fields in playbooks requires special coding, as described in Update and read custom field values later in this article. Custom field names described here require additional special handling, so plan your naming convention carefully:

  • names containing characters other than letters, numbers, or underscores (_)
  • names starting with a space

Note: When choosing a name for a new custom function, do not use the same name as a field that already exists in Splunk SOAR, like name or severity.

Create a custom field

To create a custom field, follow these steps:

  1. From the Home menu select, Administration.
  2. Select Event Settings, then Custom Fields.
  3. Select Add Field.
  4. Enter a field name.
  5. Select a field type. If you choose select, provide additional values in the Values field. These values are presented to the user in a drop-down list when working in a container.
  6. (Optional) Select Require on Resolve to make the field required before a container can be closed or resolved.
  7. (Optional) Select Add Field to add additional fields.
  8. Select Save Changes.

Edit custom fields

To edit a custom field, follow these steps:

  1. From the Home menu, select Administration.
  2. Select Event Settings, then Custom Fields.
  3. Find the item you want to edit and make your changes. In the Values field for select types, you can enter an additional value or select the X icon to remove existing values.
  4. Optionally select Require on Resolve, if appropriate.
  5. Select Save Changes.

Delete a custom field

You can remove a custom field entirely. To remove a custom field, follow these steps:

  1. From the Home menu, select Administration.
  2. Select Event Settings, then Custom Fields.
  3. Locate the field you want to remove.
  4. Select the circled x ( ⓧ ) icon at the end of the field's entry.
  5. Select Save Changes.

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