SfSkills Domains Docs GitHub

Home / devops / flow-deployment-activation-ordering

flow-deployment-activation-ordering

Deploying Flow metadata across environments when activation order matters: which flow version becomes active, how paused interviews survive deploys, avoiding the 'two active versions for a moment' race, SFDX / Metadata API deploy flags, 'Deploy as Active', rollback. NOT for Change Set vs SFDX vs package choice for a flow — use flow/flow-deployment-and-packaging. NOT for whether a change needs a new version or a new flow — use flow/flow-versioning-strategy.

Open the skill folder on GitHub


Flow Deployment & Activation Ordering

Purpose

Flow deployments are deceptively tricky. Unlike Apex, Flow preserves previous versions in the org; the "active" version is a pointer. A deploy can inadvertently deactivate the currently-running flow, leave two flows active in sequence, or break paused interviews that refer to the old version. The team hits production incidents: "the approval flow stopped triggering," "paused interviews threw after deploy," "rollback just deactivated everything." This skill codifies the sequence, guards, and verification to make Flow deploys boring.

Questions to Ask Before Configuring

AskWhy it mattersWhat a good answer adds
Which version number is active today for each changed flow, in each target org?A deploy always adds a version and never restores one, so the captured number is the whole rollback plan (Gotcha 1)A pre-deploy snapshot the rollback step can point at
Is any FlowDefinition file in the package or its source directory?Its activeVersionNumber overrides every status in the same deploy (Gotcha 2)Either an empty flowDefinitions/ or a deliberate, standalone rollback component
Is Deploy processes and flows as active enabled in production, and at what coverage?The preference does not exist in sandboxes, so a green sandbox run proves nothing about production (Gotcha 7)A release-readiness line item checked in the real target
Does a changed flow call a subflow, or is it called as one?Subflows resolve at interview time, and a child with no active version drops callers onto its latest version (Gotchas 4, 5)The child-then-caller activation order written into the runbook
How many paused or waiting interviews reference the versions in play?A version with paused interviews can't be deleted until they finish or are deleted, and deleting the interviews discards them (Gotchas 8, 9)A FlowInterview count that gates any version cleanup
Does Apex start the flow, and is deactivation the planned off switch?With no active version, the latest version runs for a flow user, and a flow admin always gets the latest (Gotcha 13)A tested kill switch in the caller instead of deactivation
Is a changed flow schedule-triggered, or does a managed package ship flows into this org?Scheduled runs pick the active version at run time, and package upgrades move active versions outside your release (Gotchas 10, 12)An activation time chosen against the next run and a post-deploy FlowDefinitionView diff

A runbook built from these answers rolls back by moving a pointer you already captured; "just deploying" leaves you redeploying old source and getting a brand-new version.

  1. Inventory changes. Which flows changed? Which have paused

    interviews or scheduled runs currently in progress?

  2. Check active versions in target org. sf data query against

    FlowDefinition and Flow to confirm what is active today.

  3. Pick activation mode. Deploy as active (default) vs deploy as

    inactive then activate via FlowDefinition update. Inactive-first is safer for risky flows.

  4. Plan the order. If Flow A calls Subflow B, deploy B first (active

    before A switches).

  5. Communicate pause windows. If paused interviews exist on the

    changing flow, delay deploy or accept that paused interviews may fail on resume.

  6. Deploy, verify, and plan rollback. Use --test-level RunSpecifiedTests --tests <ClassName> [...] when Apex callers exist (Flow itself has no test framework parity). --tests is what names the classes to run — RunSpecifiedTests on its own specifies nothing — and this level changes the coverage rule: "Each class and trigger in the deployment package must be covered by the executed tests for a minimum of 75% code coverage." Re-query active versions post-deploy; run a smoke Flow interview; check for spikes in Flow error emails. Keep the prior active version id captured before deploy — rollback = flip the pointer on FlowDefinition, not redeploy.

The Asymmetry Everything Turns On

Deploying a flow always creates a new version. It never restores an old one. Activation, by contrast, is a pointer into versions that already exist in the org. Deploy and activate are different operations with different rollback properties, and conflating them causes most incidents in this domain.

Active vs Draft Deploy

Paused Interview Risk

Paused interviews resume on the version they started on. The deploy is safe — the old version stays in the org. The cleanup is what breaks them, usually weeks later in an unrelated change, which is why nobody connects the failure back.

Subflow / Activation-Order Rules

Subflow resolution is late: the parent runs whatever version of the child is active at interview time, and the latest version if the child has none active.

Rollback Pattern

CI/CD

Anti-Patterns (see references/llm-anti-patterns.md)

Official Sources Used

The full annotated list is in references/well-architected.md.

Package files