# Running a Workflow

After following the steps to [create a Workflow](https://docs.cortex.io/streamline/workflows), you can run your Workflow to perform the sequential tasks defined in it.

## Viewing Workflow run history

To view all previous Workflow runs, you must have the `View Workflow runs` permission. All users can view their own recent runs in the [Recently run](#view-recent-runs) section.

### View all previous runs

In the **Runs** tab of the [Workflows page in Cortex](https://app.getcortexapp.com/admin/workflows), view historic runs for each Workflow, as well as each run's status: `In Progress`, `Paused`, `Successful`, `Canceled`, or `Error`. Click any of the individual actions to view the action's inputs, outputs, and run context in the side panel. Click **Waiting for approval** to view any runs that are awaiting your approval.\\

<figure><img src="https://826863033-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJW7pYRxS4dHS3Hv6wxve%2Fuploads%2Fgit-blob-7397dff2e56156d8d7901a26996cde293c855690%2Fworkflow-runs.jpg?alt=media" alt=""><figcaption></figcaption></figure>

For auditing and debugging purposes, Cortex stores run history, which includes the initiator, run context, and the inputs/outputs of each action, for 30 days.

Runs are not displayed for Workflows that have been deleted.

### View recent runs

Your recently run Workflows are displayed at the top of the [Workflows page in Cortex](https://app.getcortexapp.com/admin/workflows):

<div align="left"><figure><img src="https://826863033-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJW7pYRxS4dHS3Hv6wxve%2Fuploads%2Fgit-blob-66f0568223a1480a712eb8a826f8ffb2abe04efa%2Fworkflows-page.jpg?alt=media" alt="The Workflows page displays recent runs" width="563"><figcaption></figcaption></figure></div>

Click into one of the recent runs to view the step-by-step progress of the Workflow and each step's inputs and outputs:

<figure><img src="https://826863033-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJW7pYRxS4dHS3Hv6wxve%2Fuploads%2Fgit-blob-fd60944d7734db38c378c1d5f5155858ceeab5b1%2Fworkflow-recent-run.jpg?alt=media" alt=""><figcaption><p>Recent Workflow run, step by step</p></figcaption></figure>

To navigate to the full Workflow configuration, click **View flowchart** in the upper right corner.

## Running a Workflow

You must have the `Execute Workflow runs` permission.

When running a Workflow with Cortex-based blocks, you must have the relevant [permission](https://docs.cortex.io/configure/settings/managing-users/permissioning) in order for the Cortex-based block to succeed. For example, if you configured a block to add [Eng Intelligence custom metrics](https://docs.cortex.io/improve/eng-intelligence/custom-metrics) for an entity, you would need the `Configure Eng Intelligence Custom Metrics` permission for that block to run successfully.

### Run a Workflow from the Workflows page

1. On the [Workflows page](https://app.getcortexapp.com/admin/workflows), locate the Workflow you want to run.
2. At the top of the Workflow, click **Run**.
   * The Workflow will automatically launch. Workflows that require User input or Manual approval will pause until your configured input or approval is completed.

When a block completes, it is labeled as "Finished":

<div align="left"><figure><img src="https://826863033-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJW7pYRxS4dHS3Hv6wxve%2Fuploads%2Fgit-blob-3af0756c544ff7fc977e33458cd1745fdafb70ad%2Ffinished-action.jpg?alt=media" alt="" width="256"><figcaption></figcaption></figure></div>

Blocks that require input or approval will be labeled "Paused."

### View completed Workflows

When a run has been started, it appears in the Runs tab on the Workflows page with a "Successful" label. A Workflow awaiting input or approval will display as "Paused," and a Workflow that is currently running will display as "In progress."

<figure><img src="https://826863033-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJW7pYRxS4dHS3Hv6wxve%2Fuploads%2Fgit-blob-6d272b7d48bdb3d34575ed8e73bf74422429b617%2Fworkflow-statuses.jpg?alt=media" alt=""><figcaption></figcaption></figure>

### **Running a Workflow with secret user input**

If the Workflow has a secret user input block configured, the user running the Workflow will be prompted to enter information into the field, which will be redacted in the Workflow's **Outputs** tab. If the Workflow has regex validation configured, the user must enter a secret matching the value of the **Validation regex** that was configured for this block.

The secret fields can be seen in the **Output** of the Workflow after it has been run, but the secret values will be redacted.

{% hint style="warning" %}
Note that it is inherently possible for users with permission `Edit Workflows` to obtain secret values using complex data transformation on secrets or echoing services.
{% endhint %}

### Run a Workflow from an entity

You can also run a Workflow while viewing an entity:

1. On the left navigation menu of Cortex, click **Catalogs > All entities**.
2. Click an entity to view its details page.
3. On the left side of the entity details, click **Workflows** to view and run any entity-scoped Workflows. \\

   <figure><img src="https://826863033-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJW7pYRxS4dHS3Hv6wxve%2Fuploads%2Fgit-blob-db368620a3e70ad6361c2338dd3ce62a30f689ee%2Fentity-workflow-run.jpg?alt=media" alt=""><figcaption></figcaption></figure>

### Cancel a running Workflow

If you cancel a run that is partially complete, it will not undo any successfully completed blocks.

To cancel a running Workflow:

1. On the Workflows page, click the **Runs** tab then locate the Workflow you want to cancel.
2. Click on the Workflow to view its run details page.
3. Click **Cancel run**.\
   ![](https://826863033-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJW7pYRxS4dHS3Hv6wxve%2Fuploads%2Fgit-blob-5a52a702466a5a0f36454f91a74f6030bdbc5a66%2Fcancel-run.jpg?alt=media)

## Troubleshooting and FAQ

#### When trying to run a Workflow, why might I get the 404 error `could not find workflow with id: xyz`?

This can happen in a scenario where you have multiple tenants, and you are using an API key from the wrong tenant. Ensure that you are using the correct API key, or create a new API key and try again.
