Add a Row to a grid Using a Script
During playbook execution if a malicious finding is
discovered, you want to add that finding to a grid. You can use
a script in the playbook to add a new row to the grid with the malicious
finding.
This is a Python script, which requires 2 arguments:
fieldCliName
: the machine name
for the field for which you want to add a new row.
Row
: the new row to add the grid.
This is a JSON object in lower case characters, with no white space.
fieldCliName = demisto.args().get('field')
currentValue = demisto.incidents()[0]["CustomFields"][fieldCliName];
if currentValue is None:
currentValue = [json.loads(demisto.args().get('row'))]
else:
currentValue.append(json.loads(demisto.args().get('row')))
val = json.dumps({ fieldCliName: currentValue })
demisto.results(demisto.executeCommand("setIncident", { 'customFields': val }))