Ask Krrish Contact
Home
Developer & Admin
Apex Triggers Mastery Asynchronous Apex SOQL & SOSL Governor Limits Flows & Process Builder
Advanced Topics
LWC Essentials Security & Sharing Managed Packages Deployment & CI/CD Integration Patterns
Interview Prep
Practice interview questions
Resources
Sales Cloud Class Diagram
Blog AI News
Available Now
Agentforce Pricing Calculator New Debug Log Analyzer SFX Forge New SFX Grove SFX Travel Manager
Salesforce + AI
AI Agent Development Salesforce Agentforce Development Custom RAG Solutions AI + Salesforce Integration Customer Support AI Agents AI Lead Qualification AI Knowledge Base Assistant AI Workflow Automation
Salesforce work
Issue Fix Sprint Automation Sprint LWC & integrations Overflow support for partners Agentforce & AI usage review All services →
About Ask Krrish Contact

Salesforce Flow: Types, Best Practices and Migrating from Process Builder

Master Salesforce's powerful declarative automation tools – Flows and Process Builder. Learn to automate complex business processes, improve efficiency, and reduce the need for Apex code, empowering both admins and developers.

Need hands-on help?

Which Salesforce automation tool should I use in 2026?

Use Salesforce Flow. Support for Workflow Rules and Process Builder ended on 31 December 2025, so new automation belongs in Flow, and existing rules should move with the Migrate to Flow tool. Use before-save flows for fast same-record updates, after-save flows for related records and actions, and Apex for complex or high-volume logic.

  • Flow types: record-triggered, screen, schedule-triggered, autolaunched and platform event-triggered.
  • Before-save flows update the triggering record without extra DML, so they are much faster.
  • Never put Get, Create, Update or Delete elements inside a loop; work with collections.
  • Add fault paths to every data element so errors are handled, not just emailed.
  • Use Flow Trigger Explorer and entry conditions to control order and avoid repeat runs.

1. Introduction to Salesforce Automation

Salesforce is not just a CRM; it's a powerful platform designed to streamline business operations. At its core, automation is about reducing manual effort, improving data accuracy, and ensuring consistency across processes. For a long time, Salesforce developers primarily relied on Apex code for complex automation, while administrators used simpler tools like Workflow Rules.

However, Salesforce has significantly invested in declarative (click-not-code) automation tools, making powerful capabilities accessible to a broader audience, including administrators. This shift empowers businesses to adapt quickly without extensive developer resources.

Why is Automation Important?

  • Efficiency: Automate repetitive tasks, saving time and resources.
  • Accuracy: Minimize human error by enforcing consistent logic.
  • Consistency: Ensure business rules are applied uniformly.
  • Scalability: Handle increasing volumes of data without proportional increase in manual effort.
  • Agility: Rapidly adapt to changing business requirements with declarative tools.

This module focuses on Salesforce Flow and Process Builder, two of the most significant declarative automation tools on the platform. Understanding these tools is crucial for administrators building robust solutions and developers aiming to offload simpler logic from Apex code.

2. Understanding Salesforce Flow

Salesforce Flow is the most powerful declarative automation tool available on the Salesforce platform. It allows you to build complex business logic, interact with users, and connect to external systems through a visual interface. Think of Flow as a sophisticated workflow engine that can execute a series of actions based on triggers or user input.

Key Concepts

  • Flow Builder: The drag-and-drop visual interface where you design your flows.
  • Elements: The building blocks of a Flow — actions, interactions, or logic. Common elements include:
    • Screen: Displays information or gathers input from users.
    • Action: Creates/updates records, sends emails, calls Apex, or performs external callouts.
    • Logic: Decision (if/then), Loop (iterate over collections), Assignment (set variables), Collection Sort, etc.
    • Interaction: Pause, Subflow (call another flow).
  • Connectors: Lines that connect elements, defining the path of execution in the flow.
  • Resources: Variables, constants, formulas, text templates, and choices that store and manipulate data within the flow.

Why Flow is the Future of Declarative Automation

  • Flexibility: Handles complex branching logic, looping, and data manipulation that Process Builder cannot.
  • User Interaction: Screen Flows provide a dynamic user interface for guided processes.
  • Integrations: Built-in support for calling external services and Apex.
  • Direct Record Actions: Record-Triggered Flows offer Before Save and After Save options, similar to Apex triggers, with better performance for Before Save updates.
  • Error Handling: More robust error handling capabilities compared to other declarative tools.

Salesforce is actively enhancing Flow and consolidating other automation tools into it, making it the primary declarative automation tool moving forward.

3. Types of Flows

Salesforce Flows are categorized by how they are launched and their primary purpose. Choosing the correct Flow type is critical for efficient and effective automation.

a. Screen Flows

  • Purpose: Interact with users by presenting screens to gather input, display information, or guide them through a business process.
  • Launch: Can be launched from Flow URLs, Lightning Pages, Experience Cloud sites, Custom Buttons/Links, or the Utility Bar.
  • Use Cases: Onboarding wizards, customer service scripts, complex data entry forms, approval processes requiring user input.
  • Context: Generally runs in user context (respects user permissions).

b. Auto-launched Flows (No User Interaction)

These flows run automatically without direct user interaction and can be triggered in various ways:

  • Record-Triggered Flows:
    • Purpose: Execute automation when a record is created, updated, or deleted.
    • Fast Field Updates (Before Save): Runs before the record is saved to the database. Extremely fast and efficient for updating fields on the same triggering record. Similar to before insert/update Apex triggers.
    • Actions and Related Records (After Save): Runs after the initial record save and can perform actions on related records or send emails. Use an asynchronous or eligible scheduled path for callouts after the triggering transaction. Similar to after insert/update Apex triggers.
    • Use Cases: Auto-populating fields, updating related records, sending notifications, complex data validation.
  • Scheduled-Triggered Flows:
    • Purpose: Run at a specified time and frequency (e.g., daily, weekly).
    • Use Cases: Daily data clean-up, batch updates, sending weekly summary emails.
    • Context: Runs in system context.
  • Platform Event-Triggered Flows:
    • Purpose: Respond to platform events (real-time enterprise messaging).
    • Use Cases: Decoupled integrations, real-time dashboards, IoT data processing.
    • Context: Runs in system context.
  • Auto-launched Flow (No Trigger):
    • Purpose: Execute business logic when explicitly invoked.
    • Launch: Can be called from Apex using Flow.Interview.createInterview('FlowApiName', inputs) followed by start(), the REST API, Custom Buttons, or another Flow as a Subflow. Consider Invocable.Action for bulk invocation.
    • Use Cases: Reusable logic modules, background processing triggered by Apex, specific API integrations.
    • Context: Default context depends on the launch method, and flow settings can override it. Check sharing, object permissions, and field access.

4. Understanding Process Builder

Process Builder is a declarative automation tool that allows you to automate business processes with a visual, point-and-click interface. It's often seen as a more powerful successor to Workflow Rules but is being phased out in favor of Salesforce Flow.

Key Concepts

  • Processes: The automated business logic you build. A process can start from a record change or an event, or be invoked by another process.
  • Start Conditions: Define when the process starts (e.g., when a record is created, or created/edited).
  • Criteria: Conditions that must be met for actions to execute (e.g., Opportunity Stage = 'Closed Won').
  • Actions: What the process does when criteria are met:
    • Create a Record: Create new Salesforce records.
    • Update Records: Update the triggering record or related records.
    • Invoke a Flow: Start an Auto-launched Flow — a key feature for extending Process Builder's capabilities.
    • Call Apex: Invoke an Apex method annotated with @InvocableMethod.
    • Post to Chatter: Send messages to Chatter feeds.
    • Send Email Alerts: Use existing email alerts.
    • Submit for Approval: Automatically submit a record for approval.

When to Use Process Builder (Historically)

Historically, Process Builder was chosen when Workflow Rules were insufficient but a full Flow was considered overkill — for example, updating fields on related records, creating new records, or chaining multiple actions together.

Important: Salesforce support for Process Builder and Workflow Rules ended on December 31, 2025. Existing automation continues to run; migrate it to Flow. Use the Migrate to Flow tool where it supports the existing automation, and test the result before activation. See the Salesforce support notice for details.

How do you migrate existing automation safely?

Inventory active rules and processes, their dependencies, and pending actions before selecting a migration approach. The Migrate to Flow tool supports eligible workflow rules and record-triggered processes, but some processes require partial or manual migration. Review the tool's results and configure any actions that need attention. Test in a sandbox, including order-of-execution differences, recursion, and scheduled actions. Plan the production cutover to avoid duplicate execution, and monitor pending actions and the new flows after activation. Pending-action behavior depends on the source and migration conditions, so consult the migration considerations for the specific automation before cutover.

5. Flow vs. Process Builder vs. Workflow Rules

Understanding the strengths and weaknesses of each automation tool is crucial for making informed decisions. While Workflow Rules and Process Builder are being superseded, understanding their historical context explains why Flow is now preferred.

Comparison Table

Feature / Tool Workflow Rules Process Builder Salesforce Flow
Primary Purpose Simple field updates & email alerts Automate processes with multiple actions Complex logic, user interaction, external calls, integrations
Complexity Low Medium High (most powerful)
Execution Options Runs after the initial save; field updates update the record again Record-change processes run after save and can schedule actions; other process types have different triggers Before Save, After Save, Screen, Scheduled, Platform Event, Invoked
User Interaction (Screens) No No Yes (Screen Flows)
Loops & Collections No No Yes
Direct Delete Records No No Yes
Roll-Back Transactions Rollback depends on the transaction and error handling. Unhandled failures can roll back a transaction; use Custom Error or Roll Back Records where appropriate.
Call Apex No Yes (@InvocableMethod) Yes (an Apex Action backed by an @InvocableMethod)
External Callouts No Limited (via Apex) Yes (External Service, HTTP Callout Action, Apex)
Same-Record Update Performance Excellent (if immediate) Record-change processes run after save and can incur another update Excellent (Before Save Record-Triggered Flow)
Future State Support ended; existing automation runs; migrate to Flow Support ended; existing automation runs; migrate to Flow Supported declarative automation option

Decision Guide (New Automation)

For new automation requirements, select a tool that fits the behavior and operational needs:

  1. Consider Salesforce Flow for declarative automation.
  2. For simple same-record field updates based on criteria, use a Before Save Record-Triggered Flow — the most performant approach.
  3. For user interaction, complex branching, looping, or integrations, choose Flow when its capabilities fit the requirement.
  4. Avoid using Workflow Rules and Process Builder for new automation. Focus on migrating existing ones to Flow where possible.

6. Best Practices & Considerations

Building robust and maintainable automation requires adhering to best practices, especially with declarative tools like Flow.

a. Organize Automation by Purpose

Use cohesive record-triggered flows with selective entry criteria and controlled ordering. Group related logic where it remains understandable, and separate unrelated responsibilities when that makes testing and maintenance easier. Review the other automation on the object before adding or changing a flow.

b. Think Transactional

Understand when your Flow runs in the transaction and what impact its actions will have. Before Save is critical for performance when updating the same record. After Save allows actions on related records. Use an asynchronous or eligible scheduled path for callouts to external systems.

c. Error Handling (Fault Paths)

Implement fault paths on DML and callout elements to handle errors, notify responsible users, and provide useful diagnostics. A fault path does not itself roll back changes. An unhandled failure can roll back the transaction; use Custom Error or Roll Back Records where appropriate, and verify the effect on the transaction.

d. Performance Considerations

  • Bulkify Your Flows: Be mindful of how many records a loop processes and how many DML operations a Flow triggers. Avoid per-record actions inside loops where possible. Flow, Apex, and other automation in the same transaction share applicable governor limits.
  • Minimize DML: Batch Create Record and Update Record operations where possible.
  • Optimize Queries: Ensure Get Records elements filter efficiently.
  • Avoid Recursion: Be careful not to create infinite loops where a Flow triggers itself or another automation repeatedly.

e. Activate One Version at a Time

Only one version of a Flow can be active at a time. When making changes, create a new version, test it thoroughly, then activate it. Keep inactive versions for historical reference or rollback. Track Flow metadata and dependencies in version control, validate deployments in a sandbox, and include deployment and activation checks in the release process.

f. Naming Conventions

Implement consistent and clear naming conventions for your Flows, elements, variables, and resources. This makes your Flows readable and maintainable by the whole team.

g. Test Thoroughly

Test flows in a sandbox before deployment with success, fault, permission, edge-case, and bulk-data scenarios. For supported flows, save test scenarios and add assertions for expected outcomes. Run automated regression tests during delivery, and supplement them with tests of interactions with other automation and scheduled or asynchronous work.

How do you control record-triggered flow order?

Use Flow Trigger Explorer to inspect record-triggered flows for an object and set their relative order within the same trigger timing. Selective entry criteria and cohesive responsibilities reduce unnecessary execution and make the sequence easier to understand. Flow order does not override the wider save sequence: validation, Apex triggers, workflow rules, and other automation have their own positions, and later updates can cause automation to run again. Consult the complete order of execution when designing or migrating automation, then test interactions and recursion with realistic records and bulk updates.

When should you use asynchronous or scheduled paths?

Use an asynchronous path for work that can run after the original save commits, and a scheduled path for work tied to a later time. Each runs outside the original save transaction, so a later failure does not roll back that save. A scheduled path can be canceled or rescheduled when record conditions change; test the behavior for the intended configuration. For integrations, use Named Credentials for endpoint and authentication configuration, and design retries and idempotent operations so repeated delivery does not duplicate work. Monitor failures and account for applicable asynchronous limits and execution delays.

7. Debugging & Troubleshooting

Debugging Flows is a critical skill for any Salesforce administrator or developer. Salesforce provides robust tools to help you identify and resolve issues.

a. Flow Debugger

The Flow Debugger is an invaluable tool integrated directly into Flow Builder. It allows you to:

  • Run a Flow in Debug Mode: Simulate a Flow run with specific input values or by triggering it on a record.
  • View Execution Path: See exactly which elements were executed and in what order.
  • Inspect Variable Values: Examine the values of all variables and resources at each step.
  • Roll Back Changes: Optionally roll back any DML operations made during debugging in your sandbox.
  • Show Debug Details: Provides a detailed log of each element's execution, including queries, DML, and limits used.

In Flow Builder, click the Debug button, choose your debug options (input variables, record to trigger on), and run the session.

b. Debug Logs

For advanced troubleshooting — especially when a Flow interacts with Apex or other processes — Salesforce debug logs are essential.

  • Set up a User Trace Flag for the running user.
  • Set Workflow to FINER or FINEST; configure Apex Code and Database as needed.
  • Analyze the log for FLOW_START_INTERVIEW_BEGIN, FLOW_ELEMENT_BEGIN, FLOW_VALUE_ASSIGNMENT, FLOW_BULK_ELEMENT_LIMIT_USAGE, FLOW_INTERVIEW_FINISHED_LIMIT_USAGE, and limit errors.

c. Flow Error Emails

If an unhandled error occurs in a Flow, Salesforce sends an error email to the specified admin containing:

  • Which Flow encountered the error.
  • The specific element where the error occurred.
  • The error message details.
  • The input variables and record IDs that caused the error.

These emails are a great starting point for investigating production issues. Always ensure a responsible admin or team receives these notifications.

d. Custom Error Logging

Use fault paths to capture useful error details and route them to a responsible team. A custom-object record created in the same transaction can be rolled back with the work it records. When diagnostics must survive rollback, use transaction-independent logging, such as a suitably configured Publish Immediately platform event with a separate subscriber, and monitor delivery and processing failures.

8. Conclusion & The Future of Automation

Salesforce Flow supports declarative automation for business logic that can otherwise require code. Support for Workflow Rules and Process Builder has ended, and existing automation should be assessed for migration to Flow.

Key Takeaways

  • Choose a Suitable Tool: Consider Flow for new declarative automation when its capabilities fit the requirement.
  • Choose the Right Type: Select the correct Flow type (Screen, Record-Triggered, Scheduled, Platform Event, Auto-launched) based on your use case.
  • Prioritize Performance: Leverage Before Save Record-Triggered Flows for efficient same-record updates.
  • Best Practices are Crucial: Organize flows by purpose, control their order, handle errors, and use consistent naming conventions.
  • Master Debugging: Become proficient with the Flow Debugger and Salesforce debug logs to efficiently troubleshoot issues.

By mastering Salesforce Flows, you position yourself as a highly capable Salesforce professional — ready to tackle complex business requirements with clicks, not code, and to build scalable, maintainable, and efficient solutions on the platform.

Frequently asked questions

Is Process Builder still supported?

No. Salesforce ended support for Process Builder and Workflow Rules on 31 December 2025. Existing processes may keep running, but they no longer get support or fixes, so move them to Flow with the Migrate to Flow tool.

What is the difference between Flow, Process Builder and Workflow Rules?

All three automate record changes without code, but only Flow is still supported. Workflow Rules handled simple field updates, emails and outbound messages; Process Builder added more actions; Flow covers both plus loops, screens, scheduled paths, subflows and error handling. Support for Workflow Rules and Process Builder ended on 31 December 2025.

What is the difference between a before-save and an after-save flow?

A before-save flow (Fast Field Updates) runs before the record is saved and can only change fields on that record, with no DML, so it is fast. An after-save flow (Actions and Related Records) runs after the save and can create or update other records, send emails and call actions.

How do you stop a flow from hitting governor limits?

Keep data elements out of loops: assign changes to a collection inside the loop and run one Update Records after it. Use entry conditions so the flow runs only when relevant fields change, and avoid several flows updating the same record.

How do you debug a flow?

Use Debug in Flow Builder, with rollback mode so test runs don't save data. For record-triggered flows, check the debug log and the flow error emails, and add fault paths that log the error message.

When should I use Apex instead of Flow?

Use Apex for complex logic, very high data volumes, integrations with detailed error handling or anything that needs precise unit tests. Flow is the right default for most record automation that admins should be able to maintain.

Sources: Salesforce Help: Flow · Execution governors and limits

Get Expert Help

SFX Support — Salesforce + AI solutions. Independent: not affiliated with, endorsed by, or a partner of Salesforce, Inc. Salesforce and Agentforce are trademarks of Salesforce, Inc.