LinkIncidentsWithRetry

Use this script to avoid DB version errors when simultaneously running multiple linked incidents.

python · Common Scripts

Details

IDLinkIncidentsWithRetry
Languagepython
From Version5.0.0
Docker Imagedemisto/python3:3.12.13.10404775

README

Avoids DB version errors when simultaneously running multiple linked incidents.

Script Data


Name Description
Script Type python
Tags  

Inputs


Argument Name Description
linkedIncidentIDs The CSV list of related incident IDs.
retryLimit The number of retries to perform after a failure.

Outputs


There are no outputs for this script.

import demistomock as demisto  # noqa: F401
from CommonServerPython import *  # noqa: F401

args = demisto.args()
linkedIncidentIDs = args.get("linkedIncidentIDs")

counter = int(args.get("retryLimit"))

res = demisto.executeCommand("linkIncidents", {"linkedIncidentIDs": linkedIncidentIDs})

while isError(res[0]) and counter > 0 and ("DB Version" in res[0].get("Contents")):
    time.sleep(2)
    demisto.error(f"{counter} retry linkIncidents:{linkedIncidentIDs}")
    res = demisto.executeCommand("linkIncidents", {"linkedIncidentIDs": linkedIncidentIDs})
    counter -= 1
return_results(res)