Associate Cortex XSOAR incident fields with scripts that are triggered when the field changes.
Incident fields can be associated with trigger scripts that check for field change conditions and take actions based on the change. These scripts can perform any action, such as dynamically changing the field value, notifying the responder when an incident severity has been changed, or when the conditions are met. For example, the ChangeRemediationSLAOnSevChange
script changes the Remediation SLA of an incident, if the severity of the incident changes for any reason.
Scripts can be created in Python, PowerShell, or JavaScript on the Scripts page. To use a field trigger script, you need to add the field-change-triggered tag when creating the script. You can then add the script in the Attributes tab, when you edit or create an incident field. If you did not add the tag when creating the script, it cannot be selected, until you add the tag.
Cortex XSOAR comes out-of-the-box with field change scripts in the Scripts page, such as:
ChangeRemediationSLAOnSevChange: Changes the remediation SLA once a change in incident severity occurs.
emailFieldTriggered: Sends an email to the incident owner when the selected field is triggered.
StopTimeToAssignOnOwnerChange: Stops the Time to Assignment SLA field, as soon as an owner was assigned to an incident.
A common use case is to create a script that only allows automated changes by a playbook not manual changes by a user.
args = demisto.args() user = args["user"] if user: demisto.executeCommand("setIncident", {args["cliName"]: args["old"]})
The script checks who made the change using the user
field. The cliName argument returns the field name, so that it can be attached to multiple incident fields, and block changes to them, without the need to have a different script for each field.
If you want the script to change the incident name field and context data, run the following command:
execute_command("setIncident", {"name": incident_name, "id": incident_id})
See the following video about how to create and add scripts to an incident layout: