How to create follow-up tasks automatically when an opportunity stage changes
Build a record-triggered flow on Opportunity that runs after save when Stage changes. A Decision element picks the stage, and a Create Records element makes the Task: Assigned To ID is the opportunity owner, Related To ID is the opportunity, and the due date comes from a formula such as TODAY() + 3.
A record-triggered flow can create a follow-up task for the opportunity owner each time a deal moves stage: a discovery call when it reaches Qualification, a proposal when it reaches Proposal, a handover when it closes. The flow has four parts: the Start element (which opportunities and which changes), a Decision element (which stage), a Create Records element for each task, and a test run in Debug before you activate it.
Checked on 3 December 2026 against Trailhead, Salesforce Help knowledge articles, the Salesforce object reference and the Metadata API Developer Guide. Menu labels can move between releases, so expect small differences in wording. If you have no admin to build this, our fractional Salesforce admin service covers automation jobs like this one.
Before you start
Decide the rules on paper first. For each stage, write down the task subject, who should get it and how many days they have. Trailhead’s record-triggered flow module makes the same point: plan whether the flow runs immediately or later, and whether it runs on every update or only when the criteria are first met.
The table below is our example for a typical B2B sales process. It is not a Salesforce default, so change the stages, subjects and days to match yours.
Our example stage-to-task rules
| Opportunity moves to | Task subject | Assigned to | Due |
|---|---|---|---|
| Qualification | Book a discovery call | Opportunity owner | 2 days |
| Needs Analysis | Confirm budget and decision makers | Opportunity owner | 3 days |
| Proposal/Price Quote | Send proposal and agree a review date | Opportunity owner | 3 days |
| Negotiation/Review | Agree terms and next step with the buyer | Opportunity owner | 5 days |
| Closed Won | Arrange handover to delivery or account management | Opportunity owner | 1 day |
We would build and test the flow in a sandbox first, then deploy it to production. Without a sandbox, we would build it in production and leave it inactive until Debug runs cleanly.
Step 1: set up the Start element
The Start element decides which opportunity changes start the flow. These steps follow Trailhead’s record-triggered flow module.
- From the App Launcher, open Automation (Trailhead searches for "auto"), click New in the Flows panel and choose Record-Triggered Flow.
- Set the object to Opportunity and the trigger to run when a record is updated. Trailhead’s example uses A record is created or updated; the Metadata API Developer Guide lists Update as a trigger type of its own.
- Add the entry conditions (see the two options below).
- Set Optimize the Flow For to Actions and Related Records.
The last setting matters. Trailhead says Fast Field Updates runs before the save and is for updating the record that started the flow, while Actions and Related Records runs after the save and is for creating, updating or deleting other records. A task is another record, so this flow needs Actions and Related Records.
Two ways to stop a task on every edit
Without the right entry conditions, the flow runs every time anyone edits the opportunity and creates a new task each time. Trailhead’s example shows the same problem with contracts: if a closed won opportunity’s description is edited, "the flow will run and create another contract". There are two ways to avoid it.
Entry condition options
| Option | Entry conditions | When to run the flow | Suits |
|---|---|---|---|
| A: Stage changed | A formula: ISCHANGED({!$Record.StageName}) | The other option, so the flow runs on every update that meets the conditions | One flow that handles several stages, with a Decision element per stage |
| B: Stage reached | Stage, Equals, the stage name (for example Negotiation/Review) | Only when a record is updated to meet the condition requirements | A single stage, such as a task only when deals reach Negotiation/Review |
Option B relies on a setting the Metadata API Developer Guide describes this way: the conditions are true "only if the record didn’t meet the required conditions before the triggering update but now meets the conditions after the update". So a deal already in Negotiation/Review does not get a second task when someone edits its amount.
Option A uses a formula as the entry condition, so the flow only starts when the Stage value itself changes. The Salesforce Admins blog shows an entry condition formula with ISCHANGED({!$Record.Status}), which returns true when a field’s value differs from its previous value. For opportunities the field is StageName, so the formula is ISCHANGED({!$Record.StageName}). The same post shows PRIORVALUE, which returns the field’s previous value, if you also want to check the stage the deal came from.
Our advice: for a task on one stage, use option B. For a set of rules like the table above, use option A with one flow and one Decision element, so all the stage rules live in one place.
Step 2: add a Decision element, one outcome per stage
The Decision element sends each change down the right path. Add it after the Start element and create one outcome per stage that should get a task.
- Label each outcome after the stage, for example Moved to Proposal.
- Set the condition to Triggering Opportunity, Stage, Equals, and the stage value.
- Leave the default outcome with nothing on it. Stages you have not listed then end the flow without a task.
Closed stages need a decision of their own. The object reference says the opportunity’s Closed flag is "Directly controlled by StageName", and the OpportunityStage object says several stage values can represent a closed opportunity. If you do not want tasks for any closed stage, add a condition that Closed equals False to each open-stage outcome. If you want a handover task on Closed Won, give it its own outcome.
Step 3: create the task
Add a Create Records element on each outcome. Trailhead’s unit on adding a scheduled task to a flow uses these settings: How to set record field values set to Manually, and Object set to Task. Then set the fields.
Task fields to set in Create Records
| Field in Flow Builder | Value | What Salesforce says about it |
|---|---|---|
| Subject | The task subject from your rules, for example Send proposal | The task’s subject line. Limit: 255 characters |
| Assigned To ID | Triggering Opportunity > Owner ID | The owner of the task (OwnerId). It takes a user, or a queue |
| Related To ID | Triggering Opportunity > Opportunity ID | WhatId, which links the task to a non-human record such as an opportunity |
| Due Date Only | A formula resource, for example TODAY() + 3 | ActivityDate, the due date of the task. Label is Due Date |
| Priority | Leave blank, or set High for late stages | Required, with a default of Normal |
| Status | Leave blank | Required, with a default of Not Started |
For Assigned To ID, Trailhead tells you to pick the Owner ID that does not have a > at the end of the line, which is the ID itself, not the related user record.
For the due date, Trailhead says you usually use a formula resource to set the activity date to a date in the future. Create a new resource of type Formula with the data type Date. Salesforce’s formula guide says you can add numbers to dates, and that TODAY() + 3 returns three days after today’s date. That counts calendar days, so a task created on a Thursday with + 2 falls due on a Saturday. If that matters to your team, ask for business days in the formula.
Add a description to the flow and to each element, saying what it does and why. Trailhead’s steps fill in descriptions and say to use the Description fields to explain your intent and design.
Step 4: test it with Debug, then activate
Save the flow, then click Debug. Trailhead’s steps for a record-triggered flow are:
- Under Debug Options, select Skip start condition requirements.
- For Run the Flow As If the Record Is, select Updated.
- Choose an opportunity at the stage you are testing and click Run.
- Check the result: Trailhead says a successful run shows the connecting lines in dark blue, and Expand All in the Debug Details panel shows each step.
Trailhead says debugging before you activate lets you "try different scenarios without impacting your data". Once each outcome works, activate the flow. Then, in a sandbox or on test records, run through the cases below. This list is our advice.
Test cases we would run before go-live
| Test | Expected result |
|---|---|
| Edit an opportunity’s amount without changing the stage | No task |
| Move an opportunity to a stage that has a rule | One task, assigned to the owner, related to the opportunity, with the right due date |
| Move it to a stage with no rule | No task |
| Move it to Closed Lost | No task, unless you added a rule for it |
| Move an opportunity owned by a deactivated user | No error, and the task goes where your fallback sends it |
Common mistakes
A task on every edit
This is the entry condition problem above. The fix is option A (an ISCHANGED entry condition on Stage) or option B (only when a record is updated to meet the condition requirements). Check this first if users say they have a pile of duplicate tasks.
Tasks for closed deals
If the Decision element only tests for a stage changing, a deal moved to Closed Lost can get a follow-up task nobody needs. Test the Closed flag, or list only the open stages you want, as in step 2.
Tasks for people who have left
Salesforce Help says tasks can be assigned "to yourself or to other active users in your organization". A second Help article says that in most orgs, assigning a task to an inactive user through the API fails with the error INACTIVE_OWNER_OR_USER, unless the org has the Create Audit Fields permission, which the article says is off by default in most orgs and is enabled through Salesforce Support.
We would add a check before Create Records: Triggering Opportunity, Owner, Active, Equals True. The User object’s IsActive field shows whether the user can log in. For the false path, assign the task to a sales manager or to a queue (the Task object’s Assigned To ID accepts queues), so the follow-up is not lost.
No way to tell what the flow is for
In our experience, flows with no descriptions are hard to change a year later. Name the flow after what it does, for example Opportunity: follow-up task on stage change, and write the rules table into the flow’s description.
If the task should wait
Some follow-ups belong later, such as a check-in five days after the close date. Use a scheduled path for that. Trailhead says scheduled paths run after a period of time, are available only when the flow uses Actions and Related Records, and can be timed from a date on the record: its example is 5 days after Opportunity Close Date, creating a task for the opportunity owner.
For a pipeline that stalls rather than moves, our post on opportunities slipping under the radar covers close-date alerts, and tracking where deals die covers reporting on the stage a deal was lost from.
Getting help with Salesforce automation
Black Cloud is a UK Salesforce partner that works only on Salesforce, across the UK and Ireland. Our fractional Salesforce admin service gives you part of a senior admin’s time each month for jobs like this flow. Our managed service packages start at £950 a month for 5 hours, excluding VAT. See how we work or get in touch.
Sources
- Trailhead, "Build a Record-Triggered Flow" (checked 3 December 2026)
- Trailhead, "Get Started with Triggered Flows" (checked 3 December 2026)
- Trailhead, "Add a Scheduled Task to Your Flow" (checked 3 December 2026)
- Metadata API Developer Guide, "Flow" (checked 3 December 2026)
- Salesforce Admins blog, "Three Powerful Formula Functions You Can Use in Flow" (checked 3 December 2026)
- Object Reference, "Task" (checked 3 December 2026)
- Object Reference, "Opportunity" (checked 3 December 2026)
- Object Reference, "OpportunityStage" (checked 3 December 2026)
- Object Reference, "User" (checked 3 December 2026)
- Formulas Quick Reference, "Using Date, Date/Time, and Time Values in Formulas" (checked 3 December 2026)
- Salesforce Help, "Salesforce Activities: How to Assign Tasks and Events to Other Users" (checked 3 December 2026)
- Salesforce Help, "INACTIVE_OWNER_OR_USER Error When Assigning a Task to an Inactive User" (checked 3 December 2026)