npm package: @itentialopensource/workflow-error-event-demo
Description: Demo for the workflow error event trigger
Author: Itential Artifacts
Latest version: 0.0.13-2023.1.0

<!-- This is a comment in md (Markdown) format, it will not be visible to the end user -->

<!-- Update the below line with your Pre-Built name -->
# Workflow Error Event Demo

<!-- Leave TOC intact unless you've added or removed headers -->
## Table of Contents

* [Overview](#overview)
* [Installation Prerequisites](#installation-prerequisites)
* [Features](#features)
* [How to Install](#how-to-install)
* [How to Run](#how-to-run)
* [Additional Information](#additional-information)

## Overview

This Pre-Built demonstrates how to utilize the Operations Manager event-base trigger (Workflow Error specifically).  
The Pre-Built consist of the following:  
1. An Operations Manager item named **run-on-workflow-error** that includes a workflow-error event base trigger. This trigger is configured to fire only when the following conditions are met:
   - A job changed status from **running** state to **error**
   - The job description is `error` (using payload schema filter)
   - ![trigger](./images/trigger.png)
2. Entry point Operations Manager item named **generate-workflow-error**. This entrypoint is controlled by JSON Form that can result new job in 4 different outcomes:
   - Job finish successfully - no event trigger fired
   - Job finish successfully w/ job description `error` - no event trigger fired
   - Job goes into error state - no event trigger fired (schema mis-match)
   - Job goes into error state w/ job description `error` - event trigger fires (schema match)
   - ![make-error](./images/make-error-workflow.png)
3. Once the trigger fires successfully, a new job starts and displays context information to the user:
   - ![run-on-workflow-error](./images/run-on-workflow-error.png)
   - ![context](./images/context.png)
<!-- Write a few sentences about the Pre-Built and explain the use case(s) -->
<!-- Avoid using the word Artifact. Please use Pre-Built, Pre-Built Transformation or Pre-Built Automation -->
<!-- Ex.: The Migration Wizard enables IAP users to conveniently move their automation use cases between different IAP environments -->
<!-- (e.g. from Dev to Pre-Production or from Lab to Production). -->

<!-- Workflow(s) Image Placeholder - TO BE ADDED DIRECTLY TO GitLab -->
<!-- REPLACE COMMENT BELOW WITH IMAGE OF YOUR MAIN WORKFLOW -->
<!--
<table><tr><td>
  <img src="./images/workflow.png" alt="workflow" width="800px">
</td></tr></table>
-->
<!-- REPLACE COMMENT ABOVE WITH IMAGE OF YOUR MAIN WORKFLOW -->

<!-- ADD ESTIMATED RUN TIME HERE -->
<!-- e.g. Estimated Run Time: 34 min. -->
_Estimated Run Time_: less than a minute

## Installation Prerequisites

Users must satisfy the following pre-requisites:

<!-- Include any other required apps or adapters in this list -->
<!-- Ex.: EC2 Adapter -->
* Itential Automation Platform
  * `^2023.1`


## Features

The main benefits and features of the Pre-Built are outlined below.

<!-- Unordered list highlighting the most exciting features of the Pre-Built -->
<!-- EXAMPLE -->
<!-- * Automatically checks for device type -->
<!-- * Displays dry-run to user (asking for confirmation) prior to pushing config to the device -->
<!-- * Verifies downloaded file integrity (using md5), will try to download again if failed -->

* Demoes a workflow error event trigger 
* Able to run four different outcomes
* Gives context on the name of the workflow that errored, the ID of the workflow that errored, what the user inputted for the formData, who initiated the automation, and the error message


## How to Install

To install the Pre-Built:

* Verify you are running a supported version of the Itential Automation Platform (IAP) as listed above in the [Installation Prerequisites](#installation-prerequisites) section in order to install the Pre-Built. 
* The Pre-Built can be installed from within App-Admin_Essential. Simply search for the name of your desired Pre-Built and click the install button (as shown below).

![install](./images/install.png)

<!-- REPLACE BELOW WITH IMAGE OF YOUR PUBLISHED PRE-BUILT -->
<!--
<table><tr><td>
  <img src="./images/install.png" alt="install" width="600px">
</td></tr></table>
-->
<!-- REPLACE ABOVE WITH IMAGE OF YOUR PUBLISHED PRE-BUILT -->

<!-- OPTIONAL - Explain if external components are required outside of IAP -->
<!-- Ex.: The Ansible roles required for this Pre-Built can be found in the repository located at https://gitlab.com/itentialopensource/pre-built-automations/hello-world -->

## How to Run

Use the following to run the Pre-Built:

<!-- Explain the main entrypoint(s) for this Pre-Built: Automation Catalog item, Workflow, Postman, etc. -->
This Pre-Built runs in Operations Manager by filling out the formData and clicking Run. The user will be presented with the form to select options for how they wish the workflow to run. 

![run](./images/how-to-run.png)

## Additional Information

Please use your Itential Customer Success account if you need support when using this Pre-Built.