---
title: "Opportunity workflows"
description: "Run workflows on the sales pipeline, so a deal that changes stage, wins, loses, or goes quiet logs a task, emails its owner, or opens a ticket."
url: "https://support.outpostplatform.com/msp/opportunity-workflows/"
product: "depot"
type: "how-to"
status: "draft"
ai_summary: "MSP plan. Sales > Workflows acts on opportunities: triggers on created, updated, stage changed, won, or lost, a 15-minute check, or a schedule. Conditions on stage, value, days in stage, and more. Steps include Log a sales activity and Email a teammate. Test changes nothing. Runs and a depth-3 loop guard. Needs automation:manage."
availability:
  plans: ["msp"]
  permission: "automation:manage"
  preview: false
source: "https://gitlab.com/outpostplatform/docs/-/edit/main/src/content/docs/msp/opportunity-workflows.md"
license: "CC BY 4.0"
---

# Opportunity workflows

An opportunity workflow runs on your sales pipeline the way a ticket workflow
runs on the service desk. It can log a follow-up task when a deal reaches
**Proposal**, email the owner when a deal goes a week without activity, or
open a kick-off ticket in the client's workspace when a deal is won. This page
covers what is different about opportunity workflows. The parts they share
with ticket workflows are described in [Workflows](/service-desk/workflows/)
and [Build a workflow](/service-desk/build-a-workflow/).

## Before you begin

- You are on the MSP plan.
- Building workflows needs `automation:manage`. The **Sales** section needs
  `crm:read`.

## Build an opportunity workflow

1. Select **Sales** > **Workflows**, then **New workflow**.
2. Enter a **Name**, and choose the trigger, the conditions, and the steps, as
   described below.
3. Save, test, and turn it on as for a ticket workflow. See
   [Build a workflow](/service-desk/build-a-workflow/#build-a-workflow).

An opportunity workflow is built once for your practice and acts on every
deal, whether it is for a prospect or a client. It runs at any hour, so it has
no **Clients** or **When it runs** choice.

## Triggers

| Trigger | Runs |
| --- | --- |
| **When something happens to an opportunity** | When a deal is **created**, **updated**, **moved to another stage**, **won**, or **lost**. A deal that is won or lost has also moved to another stage. |
| **Keep checking open opportunities** | Every 15 minutes, over open deals. Use it for time-based conditions, such as a deal with no activity for 7 days. |
| **On a schedule** | At each time the schedule sets, over every open deal that meets the conditions. |

## Conditions

Conditions test the deal:

| Field | Example |
| --- | --- |
| **Stage** | Stage equals **Proposal**. |
| **Value** | At least 5,000. |
| **Probability** | At least 50. |
| **Owner** | Owner is empty. |
| **Days in stage** | At least 14. |
| **Days since activity** | At least 7. Only activities a person logged count. A deal with none counts from when it was created. |
| **Expected close in days** | At most 30. |

## Steps

| Step | What it does on a deal |
| --- | --- |
| **Change a field** | Moves the deal to a stage, named by its name, or changes its owner. |
| **Add an internal note** | Adds a note to the deal's activity. |
| **Notify people** | Notifies the opportunity owner, everyone with a role, or a specific person on your team. |
| **Create a ticket** | Opens a ticket in the deal's client. Skipped when the deal is for a prospect, which has no workspace yet. |
| **Log a sales activity** | Logs a task, note, call, email, or meeting on the deal, with a subject and a message. A task can be **For** the opportunity owner and **Due in days** (0 to 365). |
| **Email a teammate** | Emails the opportunity owner or a person on your team, at their own address. It never goes to a customer. |
| **If / Else** | Branches on conditions. |
| **Ask AI** | Asks Pioneer AI to choose a branch, and can write a note. It cannot move the deal. See [AI steps](/service-desk/workflow-ai-steps/). |

Tags, emails to an address, and webhooks are ticket steps, and are not
offered. To send pipeline events to another tool, subscribe a webhook to
`opportunity.stage_changed`, `opportunity.won`, and `opportunity.lost`. See
[API keys and webhooks](/depot/api-keys-and-webhooks/#events).

Placeholders work in the subject and message of an activity and an email.

## Test it

On the **Test** card, run a test before you turn the workflow on. By default it
checks the 25 most recently updated open deals and lists the ones it would act
on, with what it would change, log, and send. Select **Test one deal
instead** and choose a **Deal to test on** to see the result for one deal,
including why it would be skipped.

A test changes nothing, sends nothing, and calls no AI. It stops at an **Ask
AI** step and says so.

## Check what it did

The workflow's **Runs** lists every time it acted or was skipped:

| Outcome | Meaning |
| --- | --- |
| **Ran** | It acted on the deal. |
| **Skipped** | The deal did not match, or it had already acted as often as allowed. |
| **Failed** | A step failed. The reason is shown. |
| **Stopped by a loop guard** | It was stopped from reacting to a chain of its own changes. |
| **Took the AI fallback** | The **Ask AI** step could not answer, so the fallback branch ran. |

## Loops

A workflow that changes a deal's stage or owner can set off other workflows.
Outpost follows such a chain at most 3 changes deep, and a workflow never runs
for a change it made itself. Both cases are recorded as **Stopped by a loop
guard**.

While **Pause all workflows** is on, pipeline changes are not acted on, and
they are not replayed when you resume.

## Verify

- After a deal changes stage, the workflow's **Runs** shows **Ran**.
- A task from a **Log a sales activity** step appears on the deal and in
  **Sales** > **Follow-ups**.

## Next steps

- [Sales pipeline and quotes](/msp/sales-and-quotes/)
- [Workflows](/service-desk/workflows/)
