GetFilePathPreProcessing

This is a pre-processing script that is used to create the attachments of incoming incidents in an existing incident, then drop the incoming incident. It should be configured as a pre-processing rule, and the logic for finding the right incident should be added to the code manually. The automation collects the paths and names of the attachments of the incoming incident and passes it to the "CreateFileFromPathObject" automation that is being executed on the existing incident.

python · Community Common Scripts

Source

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


attachments = demisto.incidents()[0].get("attachment")
files = []
if attachments is not None:
    for attachment in attachments:
        files.append({"path": attachment["path"], "name": attachment["name"]})

    # The logic for finding the incident that we want to drop the new files to should be here
    incident = "123"
    demisto.executeCommand(
        "executeCommandAt", {"command": "CreateFileFromPathObject", "arguments": {"object": files}, "incidents": incident}
    )
    time.sleep(10)
demisto.results(False)

README

This is a pre-processing script that is used to create the attachments of incoming incidents in an existing incident, then drop the incoming incident.
It should be configured as a pre-processing rule, and the logic for finding the right incident should be added to the code manually.
The automation collects the paths and names of the attachments of the incoming incident and passes it to the “CreateFileFromPathObject” automation that is being executed on the existing incident.

Script Data


Name Description
Script Type python3
Tags preProcessing

Inputs


There are no inputs for this script.

Outputs


There are no outputs for this script.