PopulateCriticalAssets
Populates critical assets in a grid field that has the section headers "Asset Type" and "Asset Name".
- Type
- python
- Pack
- CommonScripts
Source
import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
field_cli_name = "criticalassets"
current_value = demisto.incidents()[0].get("CustomFields", {}).get(field_cli_name) or demisto.incidents()[0].get(field_cli_name)
critical_assets = demisto.args().get("critical_assets")
grid_lst = [] # type: list
for key, value in critical_assets.items():
if isinstance(value, list):
grid_lst += [{"assetname": asset_value, "assettype": key} for asset_value in value]
else:
grid_lst += [{"assetname": value, "assettype": key}]
# If the field is empty, we will set an empty value. Else, we will append the new values and set it to the field.
if not current_value:
current_value = grid_lst
else:
current_value += grid_lst
val = json.dumps({field_cli_name: current_value})
demisto.results(demisto.executeCommand("setIncident", {"customFields": val}))
README
Populates critical assets in a grid field that has the section headers “Asset Type” and “Asset Name”.
Script Data
| Name | Description |
|---|---|
| Script Type | python3 |
| Cortex XSOAR Version | 5.0.0 |
Used In
This script is used in the following playbooks and scripts.
- Calculate Severity - Critical Assets v2
Inputs
| Argument Name | Description |
|---|---|
| critical_assets | A list of all critical assets. Received as output from “Calculate Severity - Critical Assets v2” playbook. |
Outputs
There are no outputs for this script.