> For the complete documentation index, see [llms.txt](https://cortex-docs.paloaltonetworks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cortex-docs.paloaltonetworks.com/cortex-xsiam/configure-cortex-xsiam/customize-cases-and-issues/customize-case-fields-and-layouts/case-fields/case-field-triggered-scripts.md).

# Case field-triggered scripts

Configure Cortex XSIAM field-change-triggered scripts to automate case updates, enrichment, and notifications.

{% hint style="info" %}
**RBAC permissions**

Configuring case field-triggered scripts requires the following RBAC permissions:

* Under **Configurations** → **Object Setup**, **View/Edit** permission for **Fields and Types**.
* Under **Investigation & Response** → **Automations**, **Scripts** must be set to **Enabled**. Without this permission, the **Attributes** tab isn't available. In addition, if you want to create your own scripts, you must have the **Create Scripts** sub-permission selected.
  {% endhint %}

Configure Cortex XSIAM case fields to run scripts when field values change. Use case field-triggered scripts to update other case fields, notify responders, or start follow-up actions when a case changes. For example, a script can run when a case's severity or status changes.

Create case automation scripts in Python, PowerShell, or JavaScript on the **Scripts** page. To use a script as a case field trigger, add the `field-change-triggered-case` tag. Then select the script from the **Attributes** tab when you create or edit a case field. Scripts without this tag can't be selected.

When a case field that has a script changes:

* Cortex XSIAM saves the field change first, and then runs the script. The update doesn't wait for the script to finish. If the script fails, the field change is still saved.
* If a single update changes several fields that have scripts, the script assigned to each changed field runs.
* During a bulk update, a field-triggered script runs in every case where its assigned field changes.
* A script can update the case by using the `setCase` command.
* Changes that a script makes with `setCase` don't trigger other field-triggered scripts. If a script triggered by field A uses `setCase` to change field B, Cortex XSIAM doesn't run the script assigned to field B.

{% hint style="info" %}
Case and issue field-triggered scripts use different tags, arguments, and update behavior. Scripts tagged only `field-change-triggered`, are issue field triggers and don't appear in the list for case fields.
{% endhint %}

{% hint style="warning" %}
This feature assumes fair and intended usage of field-triggered scripts. In cases of excessive or abusive usage, execution may be restricted or disabled. If script execution is restricted or disabled, fields are still updated, but the assigned scripts don't run.
{% endhint %}

<details>

<summary>Case field-triggered script arguments</summary>

Case field-triggered scripts receive the following arguments (`args`):

<table><thead><tr><th width="107.00006103515625">Argument</th><th>Description</th></tr></thead><tbody><tr><td><code>name</code></td><td>The CLI name of the field that changed.</td></tr><tr><td><code>old</code></td><td>The previous value of the field.</td></tr><tr><td><code>new</code></td><td>The new value of the field.</td></tr><tr><td><code>case</code></td><td>The case after the change. Contains the values of all system and custom case fields, keyed by field CLI name, including <code>case_id</code>.</td></tr></tbody></table>

{% hint style="info" %}

* For fields that hold a list, such as multi-select fields, `new` contains the complete new value of the field, not only the added items.
* The `case` argument can arrive as an object or as a JSON string. Parse it before you use it, as shown in the example script.
  {% endhint %}

</details>

<details>

<summary>Assign a triggered script to a case field</summary>

After you create a case field-triggered script in Python, PowerShell, or JavaScript, associate it with a case field.

1. Go to **Settings** → **Configurations** → **Object Setup** → **Cases** → **Fields**.
2. Right-click the case field and select **Edit**, or click **New Field** to create a field.
3. In the **Attributes** tab, under **Script to run when field changes**, select the case field-triggered script.

   Case field-triggered scripts must have the `field-change-triggered-case` tag to appear in the list.

   <div data-gb-custom-block data-tag="hint" data-style="warning" class="hint hint-warning"><p>Case fields of type <strong>Timer</strong> and <strong>SLA</strong> don't support field-triggered scripts. The <strong>Attributes</strong> tab isn't available for these field types.</p></div>
4. Save the field.

To see which case fields have an assigned script, add the **Change Script Name** column to the table on the **Fields** tab. You can filter the table by this column.

</details>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://cortex-docs.paloaltonetworks.com/cortex-xsiam/configure-cortex-xsiam/customize-cases-and-issues/customize-case-fields-and-layouts/case-fields/case-field-triggered-scripts.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
