MarkRelatedIncidents

Marks given incidents as related to current 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

javascript · Common Scripts

Source

var related = argToList(args.related);
var openIncidents = [];
var md = '### Related incidents found\n';
for (var i=0; i<related.length; i++) {
    var incidentDetails = executeCommand('getIncidents', {id: related[i]});
    if (isValidRes(incidentDetails)) {
        md += '- ' + incidentDetails[0].Contents.data[0].name + ' [' + related[i] + '](/#/Details/' + related[i] + ')\n';
    }
    if (incidentDetails[0].Contents.data[0].status === 0 || incidentDetails[0].Contents.data[0].status === 1) {
        openIncidents.push(related[i]);
    }
}
var entry = {Type: entryTypes.note, Contents: related, ContentsFormat: formats.json,
    HumanReadable: '### Related incident found\n- ' + incidents[0].name + ' [' + incidents[0].id + '](/#/Details/' + incidents[0].id + ')\n', Note: true};
var entryJson = JSON.stringify([entry]);
for (var i=0; i<openIncidents.length; i++) {
    executeCommand('addEntries', {id: openIncidents[i], entries: entryJson});
}

return {Type: entryTypes.note, Contents: related, ContentsFormat: formats.json, HumanReadable: md, Note: true};

README

Marks given incidents as related, to the current incident.

Permissions


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 javascript
Tags Utility

Inputs


Argument Name Description
related The list of related incident IDs to be marked.

Outputs


There are no outputs for this script.