CompareIncidentsLabels
Compares the labels of two incidents. Returns the labels that are unique to each incident. This automation runs using the default Limited User role, unless you explicitly change the permissions. For more information, see the section about permissions here: - For Cortex XSOAR 6 see https://docs-cortex.paloaltonetworks.com/r/Cortex-XSOAR/6.x/Cortex-XSOAR-Playbook-Design-Guide/Automations - For Cortex XSOAR 8 Cloud see https://docs-cortex.paloaltonetworks.com/r/Cortex-XSOAR/8/Cortex-XSOAR-Cloud-Documentation/Create-a-script - For Cortex XSOAR 8.7 On-prem see https://docs-cortex.paloaltonetworks.com/r/Cortex-XSOAR/8.7/Cortex-XSOAR-On-prem-Documentation/Create-a-script
python · Common Scripts
Source
import demistomock as demisto from CommonServerPython import * try: inc1 = demisto.args().get("incident_id_1") inc2 = demisto.args().get("incident_id_2") res = demisto.executeCommand("getIncidents", {"id": inc1}) if any(is_error(entry) for entry in res): return_error(f"Unable to fetch incident {inc1}") inc1_data = res[0].get("Contents").get("data") res = demisto.executeCommand("getIncidents", {"id": inc2}) if any(is_error(entry) for entry in res): return_error(f"Unable to fetch incident {inc2}") inc2_data = res[0].get("Contents").get("data") if inc1_data is None or inc2_data is None: return_error("One of the incidents does not exist.") inc1_labels = inc1_data[0].get("labels", []) inc2_labels = inc2_data[0].get("labels", []) in1not2 = [] in2not1 = [] for label in inc1_labels: if label not in inc2_labels: in1not2.append(label) for label in inc2_labels: if label not in inc1_labels: in2not1.append(label) md = tableToMarkdown(f"Labels of incident {inc1} but not of incident {inc2}", in1not2) md += "\n" + tableToMarkdown(f"Labels of incident {inc2} but not of incident {inc1}", in2not1) if not in2not1 and not in1not2: md = "No different labels." return_outputs(md, {}, {}) except Exception as ex: return_error(f"An Error occured: {ex}", error=ex)
README
Compares the labels of two incidents. Returns the labels that are unique to each incident.
This automation runs using the default Limited User role, unless you explicitly change the permissions.
For more information, see the section about permissions here: For Cortex XSOAR 6, see the https://docs-cortex.paloaltonetworks.com/r/Cortex-XSOAR/6.x/Cortex-XSOAR-Playbook-Design-Guide/Automations for Cortex XSOAR 8 Cloud, see the https://docs-cortex.paloaltonetworks.com/r/Cortex-XSOAR/8/Cortex-XSOAR-Cloud-Documentation/Create-a-script for Cortex XSOAR 8 On-prem, see the https://docs-cortex.paloaltonetworks.com/r/Cortex-XSOAR/8.7/Cortex-XSOAR-On-prem-Documentation/Create-a-script.
Script Data
| Name | Description |
|---|---|
| Script Type | python2 |
| Tags | incidents |
| Cortex XSOAR Version | 5.0.0 |
Inputs
| Argument Name | Description |
|---|---|
| incident_id_1 | Incident ID of the first incident. |
| incident_id_2 | Incident ID of the second incident. |
Outputs
There are no outputs for this script.