Loading
Salesforce now sends email only from verified domains. Read More
Automate Your Business Processes
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          Deploy Processes and Flows as Active

          Deploy Processes and Flows as Active

          By default, processes and flows that are active in a sandbox or non-production org are deployed to a production org as inactive. After deployment, manually reactivate the new versions. In production orgs, you can enable the setting to deploy a new active version of a process or flow via change sets or Metadata API. If you use a continuous integration and continuous delivery model to deploy metadata changes, enable the option to deploy processes and flows as active.

          Required Editions

          View supported editions.
          User Permissions Needed
          To edit process automation settings: Customize Application
          To create, update, and delete flow list views: Manage Flow
          Note
          Note This setting applies to processes and autolaunched flows that are deployed via change sets and Metadata API. This setting isn't available in developer, sandbox, or other non-production orgs because you can always deploy a new active version.
          1. From Setup, in the Quick Find box, enter Automation, then select Process Automation Settings.
          2. Select Deploy processes and flows as active.
          3. Enter the flow test coverage percentage.
          4. Save your changes.

          Before you can deploy a process or autolaunched flow as active, make sure you meet flow test coverage requirements. At least one Apex test must cover the flow test coverage percentage of the active processes and autolaunched flows. Flow test coverage requirements don’t apply to flows that have screens.

          To calculate your flow test coverage, determine the number of all active flow versions with or without test coverage. Also determine the number of flow versions that are inactive, the latest version, and have test coverage. Here’s a sample query.

          SELECT count_distinct(Id) 
          FROM Flow 
          WHERE Status = 'Active' AND Id NOT IN ( 
          SELECT FlowVersionId 
          FROM FlowTestCoverage 
          )
          +
          SELECT count_distinct(FlowVersionId) 
          FROM FlowTestCoverage
          

          To determine the number of all latest flow versions that have test coverage, run all tests and use the Tooling API FlowTestCoverage object. Here’s a sample query.

          SELECT count_distinct(FlowVersionId) 
          FROM FlowTestCoverage 

          Divide the second number (number of all latest flow versions that have test coverage) by the first number (number of all active versions with or without test coverage and all of the latest inactive versions that have test coverage).

          For example, you have a total of 10 flows. Flow A has two versions. The latest version is inactive with test coverage. The first version is active without test coverage. Flows B-E each have only one version, and each version is inactive with test coverage. Flows F-J each have only one version, and each version is active with test coverage. The flow test coverage is 90%.

          Flow Label Version Status Test Coverage
          Flow A 2 Inactive Yes
          Flow A 1 Active No
          Flow B 1 Inactive Yes
          Flow C 1 Inactive Yes
          Flow D 1 Inactive Yes
          Flow E 1 Inactive Yes
          Flow F 1 Active Yes
          Flow G 1 Active Yes
          Flow H 1 Active Yes
          Flow I 1 Active Yes
          Flow J 1 Active Yes
          SELECT FlowVersion.Definition.DeveloperName 
          FROM FlowTestCoverage 
          GROUP BY FlowVersion.Definition.DeveloperName
          Tip
          Tip To get the names of all active autolaunched flows and processes that don’t have test coverage, use this query.
          SELECT Definition.DeveloperName
          FROM Flow
          WHERE Status = 'Active' 
             AND (ProcessType = 'AutolaunchedFlow' 
                OR ProcessType = 'Workflow' 
                OR ProcessType = 'CustomEvent' 
                OR ProcessType = 'InvocableProcess') 
             AND Id NOT IN (SELECT FlowVersionId FROM FlowTestCoverage)
           
          Loading
          Salesforce Help | Article