ExportContextToJSONFile
Exports the Context for the current Incident to a JSON file in the war room.
- Type
- python
- Pack
- CommonScripts
Source
import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
# get the incident id
incident_id = demisto.incident().get("id")
# get the filename
file_name = f"{demisto.args().get('filename')}.json"
# get the data from context and return the file to the war room.
data = demisto.executeCommand("getContext", {"id": incident_id})
demisto.results(fileResult(file_name, json.dumps(data[0].get("Contents", {}).get("context", {}))))
README
Exports the Context for the current Incident to a JSON file in the war room.
Script Data
| Name | Description |
|---|---|
| Script Type | python3 |
| Tags | Utility |
Inputs
| Argument Name | Description |
|---|---|
| filename | Name of the file to create in the war room, defaults to context.json. |
Outputs
There are no outputs for this script.