For the complete documentation index, see llms.txt. This page is also available as Markdown.
Cortex XSOAR 6.13

Create a Post-Processing Script

Create a post-processing script in Cortex XSOAR 6.13.

This procedure describes how to create a post-processing script after an incident has been remedied.

  1. Select Automation → New Automation.

  2. Type a name for the post-processing script and click Save.

  3. In the Tags field, from the dropdown list select Post-processing.

  4. Add fields as required.

  5. Click Save.

The following script example requires the user to verify all To Do tasks before closing an incident. Before you start, you need to configure and enable a Cortex XSOAR REST API instance.

inc_id = demisto.incidents()[0].get('id')
tasks = list(demisto.executeCommand("core-api-get", {"uri": "/todo/{}".format(inc_id)})[0]['Contents']['response'])

if tasks:

    for task in tasks:

        if not task.get("completedBy"):
            return_error("Please complete all ToDo tasks before closing the incident")
            break

In this example, we create post processing script for Service Now incidents using a SNOW instance, where there are required fields to resolve and close (such as Resolution Code, Resolution Notes, etc.).

This script works with the defaults from Service Now and resolves and closes the mirrored ticket in Service Now.

Note

If there is an additional custom argument defined for a post-processing script, the arguments closeNotes, closeReason, closed, openDuration, etc. are not available in the demisto.args() dictionary. In this case, there are two options:

  1. Remove the additional custom argument from Script settings and instead add it as a field on the Close Form for the incident type. This results in the additional argument being passed to the post-processing script.

  2. Manually add the default system arguments of closeNotes, closeReason, closed, openDuration, etc. to the Script settings, in addition to the custom argument. If not added, the code example above close_notes = demisto.args().get('closeNotes','No close notes provided') always returns "No close notes provided".

Last updated

Was this helpful?