Automated Opportunity Stage Advancement
Salesforce action: UpdateRecord_V3. Scheduled daily flow queries opportunities meeting stage advancement criteria (e.g., proposal sent + client responded), automatically advances the stage in Salesforce, reducing manual CRM hygiene work for reps.
Provided as-is, without warranty of any kind. Review and test each pattern in a non-production environment before deploying it to live automations. See our Terms.
Overview
This flow automates routine Salesforce CRM hygiene by advancing stale opportunities from one sales stage to the next on a scheduled cadence. It removes the need for sales reps or operations teams to manually nudge opportunities forward when they've sat untouched too long — a common source of pipeline data decay and missed forecasts.
The flow runs daily at 6:00 AM Eastern Time, queries open Salesforce opportunities sitting in a configurable "from" stage that haven't been modified in a configurable number of days, and moves them into a configurable "to" stage. All three of those values live in environment variables, so the behavior can be retargeted without touching the flow logic.
Use Case
Sales operations at a mid-size B2B company complained that opportunities in Proposal/Price Quote were routinely forgotten — reps would send quotes, the prospect would respond, but the stage would never get updated to Negotiation/Review. Forecasts were chronically wrong and the pipeline dashboard looked stuck.
This flow solves that by automatically promoting stale Proposal/Price Quote opportunities (unmodified for 7+ days, still open) into Negotiation/Review, giving reps a fresh trigger to review the deal. The same pattern works for any stage-to-stage progression — swap the environment variable defaults and redeploy.
Flow Architecture
Run Daily At 6AM
RecurrenceScheduled trigger that fires once per day at 06:00 Eastern Time.
Init varFromStage
Initialize variableString variable seeded from the flowlibs_SalesforceFromStage environment variable — the opportunity stage to advance FROM.
Init varToStage
Initialize variableString variable seeded from the flowlibs_SalesforceToStage environment variable — the opportunity stage to advance TO.
Init varLookbackDays
Initialize variableString variable seeded from the flowlibs_SalesforceLookbackDays environment variable — substituted into the SOQL LAST_N_DAYS literal.
Init varAdvancedCount
Initialize variableInteger variable initialized to 0; incremented as each opportunity is advanced so the run summary can report the total.
Query Stale Opportunities Via SOQL
Salesforce — ExecuteSoqlQueryRuns a dynamic SOQL SELECT against the Opportunity object filtering by StageName = varFromStage, LastModifiedDate <= LAST_N_DAYS:varLookbackDays, IsClosed = false; ordered by LastModifiedDate ascending and capped at LIMIT 100.
For Each Opportunity
Apply to eachIterates over body/records returned by the SOQL query. For each record: advances the opportunity stage in Salesforce and increments varAdvancedCount.
Advance Opportunity Stage
Salesforce — PatchItem_V3 (Update record V3)Inside the loop: updates the Opportunity record by Id, setting StageName to varToStage.
Environment Variables
| Schema name | Type | Default | Description |
|---|---|---|---|
| flowlibs_SalesforceFromStage | String | Proposal/Price Quote | Opportunity stage to advance FROM. Stored as Dataverse type String (100000000). |
| flowlibs_SalesforceToStage | String | Negotiation/Review | Opportunity stage to advance TO. Stored as Dataverse type String (100000000). |
| flowlibs_SalesforceLookbackDays | String | 7 | Max age in days since last modification. Stored as String because it's substituted directly into a SOQL literal via concat(). |
Connectors & Connections
| Connector | API name | Actions used |
|---|---|---|
| Salesforce | shared_salesforce | ExecuteSoqlQuery (Runs a dynamic SOQL SELECT against the Opportunity object.) PatchItem_V3 (Updates an Opportunity record by Id (Update record V3 in the designer).) |
Note — All connections are referenced as solution connection references; the flow is portable between environments as long as a connection is mapped at import time.
Customization Guide
Almost every realistic variant of this flow can be implemented by changing environment variable values. A few cases require small edits inside the flow definition — those are called out explicitly below.
- Change which stages are advanced
- Edit the flowlibs_SalesforceFromStage and flowlibs_SalesforceToStage env variable values in the target environment. No flow edit required. Example: set From=Qualification, To=Needs Analysis to automate early-funnel progression instead.
- Change the staleness threshold
- Edit flowlibs_SalesforceLookbackDays. The value is passed into SOQL's LAST_N_DAYS:N macro, so 14 means 'not modified in the last 14 days.'
- Run more or less often
- Edit the Run_Daily_At_6AM trigger recurrence. The flow is idempotent — running it twice in a day simply advances any newly-stale opportunities; already-advanced ones no longer match the From filter.
- Add a notification
- Insert a Teams/Outlook action after Compose_Run_Summary and use outputs('Compose_Run_Summary') as the message body.
- Cap per-run volume
- The SOQL query hard-codes LIMIT 100. Raise or lower this in the Query_Stale_Opportunities_Via_SOQL action if needed. For very large pipelines, consider pairing with an Apply-to-each concurrency of 5–10.
- Filter by record owner or type
- Extend the SOQL WHERE clause (e.g., AND RecordTypeId = 'XYZ' or AND OwnerId = :ownerId) to scope which opportunities are advanced.
Key Expressions
The flow is intentionally light on Power Fx / WDL gymnastics — the heaviest expressions are the branch-name concatenation and the approval outcome check. They are listed below in the order they appear in the flow.
EXPR.01SOQL query construction
Used in Query_Stale_Opportunities_Via_SOQL. Note the doubled single-quotes ('') — that's how you embed a literal single-quote inside a Power Automate workflow-expression string.
EXPR.02Run summary
Used in Compose_Run_Summary to produce the human-readable result string.
Comments
Sign in to join the conversation.
Sign inNo comments yet. Be the first to share your experience with this flow.