Create an incident field
Create custom incident fields in Cortex XSOAR 8 SaaS.
Incident fields are used to accept or populate incident data coming from incidents. These fields are added to incident layouts and are mapped using classification and mapping.
Creating incident fields is an ongoing process. You can create fields from information ingested from third-party integrations. As you learn more about your needs and the capabilities of your third-party integrations, you can continually add new fields to capture the most relevant information.
When investigating an incident, an analyst can easily add relevant information to the fields in the layout. Incident fields can be populated by incident team members during an investigation at the beginning of the investigation or before closing the investigation.
Note
In the CLI, you can set and update all system incident fields using the setIncident command, of which each field is a command argument.
Incident field trigger scripts
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.
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:
See the following video about how to create and add scripts to an incident layout. Dynamic Sections
Create dynamic fields
Dynamic fields can display different data depending on the field value. You can control which fields display in an incident layout, new/edit, and close forms, and which values display for single-select and multi-select fields. You create a script on the Scripts page and then add the script to a field. Scripts support JavaScript, Python, and PowerShell.
Dynamic fields are useful in the following scenarios:
You want specific values to appear in a field when the value of another field is different. For example, if the value in the Owner field is
Admin, the values in the assignee field should beJane,Joe, orBob. If the value in the Owner field is anything else, the values in the assignee field should beMark,Jack, orChristine.You can use display scripts to change the value displayed in single-select or multi-select fields in the layout. The field displays a list of options, but when selected, the field may show a different value in the layout than the one selected. For example, in a single-select field, select an incident from a list of incident names, but the field is populated with the incident ID (not the name) of the related incident.
When assigning an incident to a user, you want to see only relevant data according to the user’s role.
Create a script.
Go to the Scripts page and select New Script.
Give the script a descriptive name.
Enter a useful description.
Under Tags, select
field-display.This tag must be applied for the script to be available in the field you want to add the script.
Write the script.
Cortex XSOAR comes out-of-the-box with the
hideFieldsOnNewIncidentfield-display script, which hides the incident field for new incidents, but appears when editing an incident.The field script contains the following.
NameDescriptiondemisto.incidentsThe incident in which this script is running.
fieldThe field attributes. Add metadata to the field, such as
cliName,type,select values, etc. For example,[‘field’] [‘cliName’]is the machine learning name of the field.formTypeEnables Cortex XSOAR to process the script in the
new,edit,closeincident forms. For example, you may want the field to appear in the close form and not in the edit form.incident.get (‘field’)The field within the incident. For example,
incident.get.(‘owner’)retrieves theownerfield. If you create a custom field, you need to change this toCustomFields. For example, for theincidentclassificationcustom field, type:if incident.get('CustomFields').get('incidentclassification').demisto.resultsThe results to return.
currentUserSpecifies the current user. For example, if you want the script to check on a role assigned to user and display the appropriate output, type the following:
demisto.executeCommand("getUserByUsername", {"username": demisto.args()["currentUser"] })Add the information that you want to display according to the user roles.
Create an incident field.
Select Settings & Info → Settings → Object Setup → Incidents → Incident Fields → New.
If you want to add the script to an existing field, select the field and click Edit.
Under Field Type, select the field type. For example, Single select.
Under Field Name, enter a descriptive name.
Under the Attributes tab, in the Field display script field, select the script you created in step 1.
Complete the remaining field definitions Save the field.
Troubleshoot incident fields
Last updated
Was this helpful?




