Automating with Salesforce Flow
Automate processes without code, with full control.
What does automation mean in Salesforce?
Automation in Salesforce is about reducing manual work by letting processes run automatically. Instead of an employee manually sending an email, updating a field, or creating a task, Salesforce does this automatically based on rules you set up.
π‘ A comparison
Flow works like traffic lights for data. Just as traffic lights control traffic based on fixed rules (green = go, red = stop), Flow controls what happens to your data based on conditions you define.
What is Salesforce Flow?
Salesforce Flow is the modern standard for automation within Salesforce. It's a powerful tool that lets you build complex business processes without writing code. Using a visual interface, you drag elements together and determine how data flows through your system.
A Flow consists of different steps that execute one after another. Each step can retrieve data, modify it, make decisions, or interact with users. Together, these steps form a process that runs automatically when certain conditions are met.
Types of Flows
Record-Triggered Flow
Starts automatically when a record is created, updated, or deleted. Ideal for automatic actions after changes.
Screen Flow
Shows screens to users to enter data or make choices. Perfect for guided processes.
Scheduled Flow
Runs at fixed times, for example every night or monthly. Useful for recurring batch updates.
Autolaunched Flow
Called from other processes, such as Apex or another Flow. Used for reusable logic.
Example: Website Lead Request (Screen Flow)
Below you can see an example of what a Screen Flow looks like in the Salesforce Flow Builder. This flow processes a website request: from filling out a form to creating a Lead and sending a notification.
Website Lead Aanvraag
Screen Flow β’ Actief
Screen Flow
Start
Contactformulier
Screen
Valideer Invoer
Decision
Zoek Bestaande Lead
Get Records
Maak Lead Aan
Create Records
Verstuur Notificatie
Apex Action
Bevestiging
Screen
When do you use Flow?
Salesforce has had multiple automation tools over the years. Process Builder and Workflow Rules were commonly used before, but Salesforce now recommends using Flow for all new automations. Flow is more powerful, more flexible, and receives all new features.
β οΈ Note: Process Builder and Workflow Rules
Although Process Builder and Workflow Rules still work, Salesforce advises always building new automation in Flow. You can gradually migrate existing processes to Flow.
When do you choose Flow?
Flow is suitable when you:
- βWant to execute actions when a record is created or modified
- βNeed complex logic with multiple conditions and decisions
- βWant to retrieve or update related records
- βWant to guide users through a process with screens and choices
- βWant to automate recurring tasks at fixed times
The key Flow elements
You build a Flow from different elements. Each element has a specific function. Below we explain the most commonly used elements.
Get Records (Retrieve data)
With this element you retrieve existing records from your database. You set conditions to determine which records you want to retrieve, for example "all Opportunities with status 'Open' and owner is current user".
Practical example
You want to retrieve all open tasks from an Account when that Account's status changes to "Inactive".
Get Records: Retrieve tasks where
- Account = current Account
- Status = 'Open'
- Then: close all retrieved tasksCreate Records
With this you create new records. This can be a single record or multiple records at once. You determine which fields you want to fill with fixed values or with information from other parts of your Flow.
Practical example
When an Opportunity reaches the "Closed Won" stage, automatically create a Project record with that Opportunity's data.
Create Record: Project with
- Name = Opportunity.Name
- Account = Opportunity.Account
- Start Date = Today
- Owner = Opportunity.OwnerDecision
The Decision element is the heart of your logic. With it you split the Flow into different paths based on conditions. Think of "if this is true, do that, otherwise do something else".
Practical example
When a Case is created, determine which action to take based on urgency.
Decision: Check urgency
Path 1: If Priority = 'High'
β Assign to senior support employee
β Send immediate notification
Path 2: If Priority = 'Medium' or 'Low'
β Assign to support queue
β Send standard notificationUpdate Records
You use this element to modify existing records. You can update the record that started the Flow, or records you previously retrieved with Get Records.
Practical example
Update the Account record when a linked Opportunity is won, by updating the "Last win date" field.
Update Record: Account with
- Last_Win_Date__c = Today
- Total_Revenue__c = current value + Opportunity.AmountAssignment (Set variables)
With Assignment you can store values in variables that you use later in the Flow. This is useful for calculations or to temporarily hold information.
Practical example
Count the number of won Opportunities and store this number to use later in an email notification.
Assignment:
- Variable: TotalOpportunityCount
- Action: Add 1
- Use later in: Email message ("You now have TotalOpportunityCount won deals")Loop (Repeating actions)
A Loop goes through a collection of records one by one and executes the same actions for each record. This is essential when you want to process multiple related records.
Practical example
Loop through all contacts of an Account and update their preferred language when the Account's language changes.
Loop: Through all Contacts of the Account
- For each Contact:
Update Contact.PreferredLanguage = Account.Language
- Continue until all Contacts are processedApex Action (advanced logic)
Sometimes Flow alone won't get you there β for example when you need complex calculations, API connections, or logic with multiple objects. In that case you use an Apex Action. This is a piece of code (Apex Class) that you can call from Flow to perform specific actions that aren't possible in Flow itself.
Practical example
Suppose you want to retrieve customer data via an external API or calculate a lease price with multiple parameters. You can have such a calculation executed in Apex and then use it in your Flow via an "Apex Action". You pass the required input values (e.g. customerId or vehicleType), and receive the result as a variable.
Example: you use a fictional Apex class that calculates a monthly price. In your Flow you add the Apex Action element, select the relevant class, fill in the input fields and store the result in a Flow variable.
Free example: AddressSplit Apex
Want to see a concrete and safe example? Check out our free AddressSplit Apex that neatly splits street, house number, and suffix.
Download the AddressSplit ApexWhen do you use Apex or Flow?
Not sure whether to build something in Flow or solve it with Apex? In this article we explain it clearly.
Read the articleSubflow (reusing logic)
Sometimes you use the same automation step in multiple flows. Instead of copying that logic everywhere, you create one autolaunched flow and call it as a subflow. This keeps your org organized and you only need to make changes in one place.
Practical example
Reuse a welcome procedure after creating or updating an Account.
1) Create autolaunched flow "Account Welcome Procedure":
- Retrieve Account based on passed Id
- Create task for the owner
- (Optional) Send email
2) In your record-triggered flow on Account: add "Subflow" element
3) Pass Account Id as input
4) Changes? Only modify the subflow (e.g. task after 5 instead of 3 days)- less duplicate logic in your org
- easier maintenance
- flows remain shorter and more readable
- one place for error handling or logging
Screen (User interaction)
Screen elements are shown to users to collect information or let them make choices. This is only available in Screen Flows and is perfect for guided processes.
Practical example
Show a screen to the salesperson to enter additional information before an Opportunity is converted to a Project.
Screen: "Project details"
- Field: Desired start date (date)
- Field: Project type (dropdown)
- Field: Notes (text field)
β Use these values to create the ProjectPractical example: Status update with notification
Let's work through a concrete example: when an Opportunity's status changes to "Closed Won", we want to send a notification to the related Account's owner and update a field on the Account.
Step-by-step walkthrough
Start the Flow
Trigger: Record-Triggered Flow on Opportunity
When: Record is updated
Condition: StageName changes to "Closed Won"
Retrieve the Account
Get Records: Retrieve the Account where Id = Opportunity.AccountId
Save as: variable "RelatedAccount"
Check if Account exists
Decision: Is RelatedAccount not empty?
β Yes: Continue with the next steps
β No: Stop the Flow (safety measure)
Update the Account
Update Records: RelatedAccount
Update field: Last_Opportunity_Won__c = TODAY()
Update field: Won_Deal_Count__c = current value + 1
Send notification
Action: Send email
To: RelatedAccount.OwnerId
Subject: "New won deal at " + RelatedAccount.Name
Message: "Congratulations! The opportunity [Name] was won with a value of [Amount]."
π‘ The logic explained
If Opportunity's StageName changes to "Closed Won",
Then retrieve the related Account,
And update two fields on that Account,
And send an email to the Account owner.
Best Practices for Flow
To keep your Flows organized, reliable, and maintainable, there are several important guidelines.
1. Use clear names
Give your Flow, variables, and elements recognizable names that immediately make clear what they do.
Good: "Account - Notification on won Opportunity"
Good: "varAccountOwner", "getRelatedContacts"
Bad: "Flow1", "var1", "Get Records 3"2. Test with Debug
Use the Debug function to test your Flow step by step before activating it. This way you see exactly which values flow through where.
In the Flow Builder: click "Debug" in the top right β Fill in test values β View the output of each element β Verify everything works as expected
3. Protect against empty values
Always check if fields or records exist before using them. An empty value (null) can crash your Flow.
Use a Decision element to check:
- Is variable not empty? β Continue
- Is variable empty? β Stop or use default value
Example: Check if Account.Owner is not null before sending an email4. Use Subflows for reusable logic
When you use the same logic in multiple Flows, build a Subflow (Autolaunched Flow) that you can call. This makes maintenance easier.
Example: Subflow "Send welcome email"
- Input: Contact Id
- Action: Retrieve Contact, retrieve template, send email
- Output: Success (true/false)
You can call this Subflow from multiple Flows that need to send a welcome emailMultiple record-triggered flows on the same object? Configure Flow Trigger Order (1-2000) in the flow properties to determine the order. Read more about Order of Execution
5. Document your Flow
Add a description to your Flow and use the description field on important elements. This helps colleagues (and your future self) understand what the Flow does.
Flow description: "This Flow runs when an Opportunity is won. It updates the related Account and sends a notification to the Account owner."
6. Watch governor limits
Salesforce has limits on the number of actions a Flow may execute. Avoid actions inside loops and use bulkified updates where possible.
Bad: Loop through 100 Contacts and update each Contact separately (100 updates)
Good: Loop through 100 Contacts, collect them in a collection, and update the entire collection at once (1 update)Common automation scenarios
Here are some practical examples of when Flow provides a solution:
Lead assignment
Automatically assign new Leads to the right salesperson based on region, product type, or lead source.
Case escalation
When a Case has been open too long, automatically escalate to a manager and update the priority.
Contract renewal
When a Contract is about to expire, automatically create a task for the account manager to reach out.
Opportunity approval
For large deals, automatically start an approval process where a manager must give approval.
Data synchronization
When a field on Account changes, automatically update the same field on all related Contacts.
Onboarding process
For a new customer, automatically create a checklist with tasks for different departments.
Conclusion
Salesforce Flow is a powerful tool for automating manual processes and making your team work more efficiently. By smartly automating processes you save time, reduce errors, and ensure consistency in your workflow.
Start small with simple automations, like sending a notification or updating a field. As you gain more experience, you can build more complex processes with loops, decisions, and subflows.
Next steps
Want to learn more about Salesforce? Also check out our article on standard and custom objects, or contact us for advice on automation within your organization.
View all articles βWant to clean up or expand your Flow landscape?
We design scalable Flows, set up governance and determine together where Apex or integrations are needed.
