Salesforce Flow Cheat Sheet

 

Introduction to Salesforce Flow

Salesforce Flow allows you to automate business processes, such as approvals, task creation, record updates, and more. Flows can be simple or complex, catering to various business needs.



Key Benefits:

  • Automation: Save time by automating repetitive tasks.
  • Flexibility: Create custom solutions tailored to your business.
  • User-Friendly: No need for advanced coding knowledge.

Types of Flows

Salesforce Flow offers various types of flows to cater to different automation needs. Each type is designed to handle specific use cases and triggers. Here’s an overview of the different types of flows available in Salesforce:

1. Screen Flow

  • Description: A Screen Flow is an interactive flow that requires user input. It is used to guide users through a series of screens, capturing information, and performing actions based on the input.
  • Use Cases:
    • Collecting customer information during a service call.
    • Guiding users through a multi-step process like onboarding or troubleshooting.
    • Interactive data entry forms for sales or service reps.
  • Trigger: Manually started by a user from a Lightning page, utility bar, or actions like buttons and links.

2. Schedule-Triggered Flow

  • Description: This type of flow runs automatically at specified times and intervals. It is used for time-based automation, such as daily, weekly, or monthly tasks.
  • Use Cases:
    • Sending reminder emails to customers or employees.
    • Performing routine maintenance tasks like data cleanup.
    • Generating and sending reports at regular intervals.
  • Trigger: Scheduled to run at specified times, which can be set in the flow settings.

3. Record-Triggered Flow

  • Description: A Record-Triggered Flow runs automatically when a record is created or updated in Salesforce. It allows you to automate actions directly tied to changes in your records.
  • Use Cases:
    • Updating related records when a record changes.
    • Sending notifications when a record is created or modified.
    • Automating approval processes based on record changes.
  • Trigger: Automatically triggered by the creation or update of a record.

4. Platform Event-Triggered Flow

  • Description: This flow is triggered by platform events, which are custom notifications sent from external systems or other parts of Salesforce. It is useful for integrating Salesforce with external systems and handling event-driven processes.
  • Use Cases:
    • Responding to events from external systems (e.g., IoT device notifications).
    • Handling custom event-driven logic within Salesforce.
    • Integrating with third-party applications through event-driven architecture.
  • Trigger: Automatically triggered by the receipt of a platform event.

5. Autolaunched Flow

  • Description: An Autolaunched Flow is a flow that runs automatically without user interaction. It can be invoked by Apex code, Process Builder, or other flows. These flows do not have screens and are designed to run in the background.
  • Use Cases:
    • Automating complex business logic without user input.
    • Handling backend processes like data updates and integrations.
    • Running batch processes and data manipulations.
  • Trigger: Can be invoked programmatically via Apex, from Process Builder, or other flows.

Comparison of Flow Types

Flow TypeUser InteractionCommon TriggersUse Cases
Screen FlowYesManual user initiationGuided data entry, multi-step processes
Schedule-Triggered FlowNoScheduled time intervalsScheduled tasks, routine maintenance, periodic reports
Record-Triggered FlowNoRecord creation/updateReal-time data updates, notifications, approval processes
Platform Event-Triggered FlowNoPlatform eventsEvent-driven integrations, custom event handling
Autolaunched FlowNoApex, Process Builder, other flowsBackground processes, complex business logic

Understanding these flow types and their appropriate use cases will help you choose the right type of flow for automating your business processes in Salesforce.

Flow Builder Overview

Flow Builder is the tool within Salesforce that you use to create, configure, and manage flows. It provides a user-friendly, drag-and-drop interface to help you design complex business processes without needing to write code. Here's an overview of the main components and features of Flow Builder.

Key Components of Flow Builder

  1. Canvas
  2. Palette
  3. Manager
  4. Debug

1. Canvas

  • Description: The Canvas is the main workspace where you design your flow. It provides a visual representation of the flow and allows you to see how different elements are connected.
  • Key Features:
    • Drag and drop elements from the Palette to the Canvas to add them to your flow.
    • Click and drag between elements to connect them and define the flow’s path.
    • Zoom in and out to get a better view of complex flows.

2. Palette

  • Description: The Palette contains all the elements and resources you can use in your flow. Elements are actions or operations that your flow can perform, such as creating records, making decisions, or displaying screens.
  • Key Elements:
    • Interaction: Screen, Pause, Action
    • Logic: Assignment, Decision, Loop, Collection Sort, Collection Filter
    • Data: Create Records, Update Records, Get Records, Delete Records, Lookup
    • Integrations: Subflow, Apex Action, Email Alert, Post to Chatter, Send Custom Notification, Call Integration

3. Manager

  • Description: The Manager panel lists all the resources you use in your flow. Resources include variables, constants, formulas, and more. This panel helps you manage and organize these resources effectively.
  • Key Resources:
    • Variables: Store data that changes during the flow.
    • Collections: Hold multiple values of the same type.
    • Constants: Store fixed values that don’t change.
    • Formulas: Perform calculations using other variables and resources.
    • Text Templates: Store reusable text snippets for use in screens and actions.

4. Debug

  • Description: The Debug feature allows you to test your flow to ensure it behaves as expected before activating it. Debugging helps you identify and fix errors, and understand how data moves through the flow.
  • Key Features:
    • Run: Test the flow by running it as if it were live.
    • Test with Inputs: Provide input values to simulate different scenarios.
    • Debug Log: View detailed logs of each step, including data values and decision outcomes.
    • Error Handling: Identify and correct errors before activating the flow.

Additional Features

  • Versioning: Flow Builder allows you to create multiple versions of a flow. This is useful for testing changes and maintaining historical versions of your flows. You can activate a specific version to make it the current version that users interact with.

  • Reusability: Elements like subflows and custom Apex actions can be reused across different flows, promoting modularity and reducing redundancy.

Creating a Simple Flow: Step-by-Step Example

  1. Access Flow Builder:

    • Navigate to Setup.
    • Enter "Flows" in the Quick Find box.
    • Select Flows and click New Flow.
  2. Select Flow Type:

    • Choose the type of flow you want to create, such as Screen Flow.
    • Click Create.
  3. Add Elements to the Canvas:

    • Drag a Screen element from the Palette to the Canvas.
    • Name the screen (e.g., "Customer Information") and add fields like Name, Email, and Phone.
  4. Configure Screen Fields:

    • Click each field to configure its properties, such as label, required status, and help text.
  5. Add a Decision Element:

    • Drag a Decision element to the Canvas.
    • Configure the decision to branch based on the data entered by the user (e.g., if Email is provided, go to one path; if not, go to another).
  6. Connect Elements:

    • Click and drag from the Screen element to the Decision element to connect them.
    • Define the paths from the Decision element to other actions or screens.
  7. Save and Activate:

    • Click Save and give your flow a name.
    • Click Activate to make the flow live and ready for use.

Flow Builder’s intuitive interface and powerful features make it easy to design and automate complex business processes. By understanding and utilizing these components, you can create efficient and effective flows that enhance your Salesforce environment.

Elements of a Flow

In Salesforce Flow, elements represent specific actions or operations that your flow can perform. Understanding the different types of elements and how to use them is crucial for building effective flows. Here are the most commonly used elements in Salesforce Flow:

1. Screen

  • Description: Displays a screen to the user to collect input or show information.
  • Use Cases: Interactive forms, guided data entry, user surveys.
  • Configuration: Add fields, text, choices, and other UI components.

2. Create Records

  • Description: Creates new records in Salesforce based on the data provided.
  • Use Cases: Creating new leads, accounts, or custom objects.
  • Configuration: Specify the object type and set field values for the new records.

3. Update Records

  • Description: Updates existing records in Salesforce with new values.
  • Use Cases: Modifying records based on user input or other criteria.
  • Configuration: Specify the records to update and the fields to modify.

4. Get Records

  • Description: Retrieves records from Salesforce based on specified criteria.
  • Use Cases: Fetching data to display to the user or to use in decision-making.
  • Configuration: Define the object type, filter conditions, and fields to retrieve.

5. Delete Records

  • Description: Deletes records from Salesforce.
  • Use Cases: Removing obsolete or incorrect records.
  • Configuration: Specify the records to delete using filter criteria.

6. Decision

  • Description: Adds branching logic to your flow, allowing it to take different paths based on conditions.
  • Use Cases: Handling different scenarios based on user input or data values.
  • Configuration: Define outcome conditions and specify the paths for each outcome.

7. Assignment

  • Description: Assigns values to variables within the flow.
  • Use Cases: Storing and updating data during the flow execution.
  • Configuration: Specify the variable and the value to assign.

8. Subflow

  • Description: Calls another flow from within the current flow.
  • Use Cases: Reusing common logic across multiple flows.
  • Configuration: Specify the flow to call and pass any necessary input variables.

9. Loop

  • Description: Iterates over a collection variable, performing actions for each item.
  • Use Cases: Processing lists of records or performing repeated actions.
  • Configuration: Specify the collection variable and define the loop actions.

10. Pause

  • Description: Pauses the flow until a specified event occurs.
  • Use Cases: Waiting for user approval, external system response, or a set duration.
  • Configuration: Define the conditions that will resume the flow.

11. Apex Action

  • Description: Executes custom Apex code within the flow.
  • Use Cases: Performing complex operations not supported by standard flow elements.
  • Configuration: Specify the Apex class and pass any required input parameters.

12. Email Alert

  • Description: Sends an email alert to specified recipients.
  • Use Cases: Notifying users or customers about important events.
  • Configuration: Define the email template, recipients, and any merge fields.

13. Post to Chatter

  • Description: Posts a message to a Chatter feed.
  • Use Cases: Sharing updates or announcements with team members.
  • Configuration: Specify the message content and the Chatter group or user to post to.

14. Send Custom Notification

  • Description: Sends a custom notification to specified users or groups.
  • Use Cases: Alerting users about specific events or actions.
  • Configuration: Define the notification content and recipients.

15. Call Integration

  • Description: Integrates with external systems using outbound messaging or platform events.
  • Use Cases: Syncing data with external applications or services.
  • Configuration: Define the integration parameters and actions.

Summary Table of Flow Elements

ElementDescriptionUse Cases
ScreenDisplays a user interfaceInteractive forms, data entry, surveys
Create RecordsCreates new records in SalesforceAdding new leads, accounts, custom objects
Update RecordsUpdates existing recordsModifying records based on user input or criteria
Get RecordsRetrieves records from SalesforceFetching data for display or decision-making
Delete RecordsDeletes records from SalesforceRemoving obsolete or incorrect records
DecisionAdds branching logicHandling different scenarios based on conditions
AssignmentAssigns values to variablesStoring and updating data during flow execution
SubflowCalls another flowReusing common logic across multiple flows
LoopIterates over a collectionProcessing lists of records or performing repeated actions
PausePauses the flow until a specified event occursWaiting for approval, external response, or set duration
Apex ActionExecutes custom Apex codePerforming complex operations
Email AlertSends an email alertNotifying users or customers about important events
Post to ChatterPosts a message to a Chatter feedSharing updates or announcements
Send Custom NotificationSends a custom notificationAlerting users about specific events or actions
Call IntegrationIntegrates with external systemsSyncing data with external applications or services

By understanding and effectively utilizing these elements, you can create powerful and flexible flows that automate a wide range of business processes in Salesforce.

Resources in Flow

Resources in Salesforce Flow are variables and constants that store data used throughout the flow. They help manage and manipulate information, making your flows dynamic and flexible. Here’s a detailed overview of the different types of resources available in Salesforce Flow:

Types of Resources

  1. Variables
  2. Collections
  3. Constants
  4. Formulas
  5. Text Templates
  6. Choice

1. Variables

  • Description: Variables are containers that store data that can change during the flow’s execution. They can hold single values like text, numbers, dates, or record references.
  • Use Cases: Storing user input, holding intermediate calculations, managing state throughout the flow.
  • Configuration: Define the data type (Text, Number, Date, Boolean, etc.), API name, and optional default value.

2. Collections

  • Description: Collections are special types of variables that can hold multiple values of the same data type. They are useful for working with lists of records or repeating groups of values.
  • Use Cases: Storing lists of records, accumulating multiple values for processing, looping through data sets.
  • Configuration: Define the data type (Text, Number, Record, etc.) and API name.

3. Constants

  • Description: Constants store fixed values that do not change during the flow’s execution. They are useful for defining static values that you need to use multiple times within the flow.
  • Use Cases: Storing predefined values like statuses, thresholds, or reference data.
  • Configuration: Define the data type and set the constant value.

4. Formulas

  • Description: Formulas perform calculations using other variables, constants, or record fields. They can include mathematical operations, logical expressions, and text manipulations.
  • Use Cases: Calculating values on the fly, concatenating strings, performing conditional logic.
  • Configuration: Use Salesforce’s formula syntax to define the calculation or expression.

5. Text Templates

  • Description: Text Templates store reusable chunks of text that can include variables. They are useful for generating dynamic content like emails, messages, or screen labels.
  • Use Cases: Creating email bodies, constructing messages for users, building dynamic labels.
  • Configuration: Define the template content using plain text and merge fields for dynamic data insertion.

6. Choice

  • Description: Choices represent a single option that can be selected by users in Screen elements. They can be static or dynamic, based on data from Salesforce records or other resources.
  • Use Cases: Populating picklists, radio buttons, or multi-select components in screens.
  • Configuration: Define the choice label and value, and specify if it’s static or dynamically sourced.

How to Create a Resource

  1. Open Flow Builder:

    • Navigate to your flow and open it in Flow Builder.
  2. Access the Manager:

    • Click on the Manager tab on the left side of the screen.
  3. Create a New Resource:

    • Click New Resource.
  4. Select Resource Type:

    • Choose the type of resource you want to create (e.g., Variable, Collection, Constant).
  5. Define Resource Details:

    • Enter the required details such as API Name, Data Type, and Description.
    • For variables and collections, specify the data type and any default values.
    • For formulas, enter the formula expression using Salesforce’s formula syntax.
  6. Save the Resource:

    • Click Done to save the resource.

Examples of Resource Usage

Example 1: Using Variables

  • Scenario: You want to capture user input from a Screen element and use it in later steps.
  • Steps:
    1. Create a Text Variable named userInput.
    2. Add a Screen element to capture input and store it in userInput.
    3. Use the userInput variable in subsequent elements, such as creating a record or sending an email.

Example 2: Using Collections

  • Scenario: You need to retrieve a list of records and process each one.
  • Steps:
    1. Create a Record Collection Variable named accountList.
    2. Add a Get Records element to retrieve records and store them in accountList.
    3. Use a Loop element to iterate over accountList and perform actions on each record.

Example 3: Using Formulas

  • Scenario: You want to calculate a discount based on a percentage.
  • Steps:
    1. Create a Number Formula named discountAmount.
    2. Define the formula as OrderAmount * DiscountPercentage / 100.
    3. Use discountAmount in an Assignment element to apply the discount.

Summary Table of Resources

Resource TypeDescriptionUse Cases
VariablesStore dynamic data valuesUser input, intermediate calculations
CollectionsStore multiple values of the same typeLists of records, groups of values
ConstantsStore fixed valuesPredefined statuses, reference data
FormulasPerform calculations and expressionsDynamic calculations, text concatenation
Text TemplatesStore reusable chunks of textEmail bodies, dynamic messages
ChoiceRepresent selectable options in screensPopulating picklists, radio buttons

By effectively using these resources, you can make your flows more dynamic, reusable, and easier to manage. They provide the flexibility needed to handle various business processes and scenarios in Salesforce Flow.

Best Practices for Salesforce Flows

Building efficient and maintainable flows is crucial for ensuring smooth automation and user experience in Salesforce. Here are some best practices to follow when designing and implementing Salesforce Flows:

1. Plan Before You Build

  • Description: Before diving into Flow Builder, take the time to map out your process. Identify the inputs, outputs, decision points, and actions required.
  • Benefits: Ensures you have a clear understanding of the process, which helps in designing a logical and efficient flow.
  • Tips:
    • Use flowcharts or diagrams to visualize the process.
    • Identify potential bottlenecks or complexities in advance.

2. Use Descriptive Names and Descriptions

  • Description: Name your flows, elements, variables, and other resources clearly and descriptively.
  • Benefits: Makes your flows easier to understand and maintain, especially for others who may work on them in the future.
  • Tips:
    • Use naming conventions that include the purpose and context (e.g., Create_Account_Record).
    • Provide detailed descriptions for each element and resource.

3. Keep Flows Modular

  • Description: Break down complex flows into smaller, reusable subflows.
  • Benefits: Simplifies the design, makes it easier to debug and maintain, and promotes reusability.
  • Tips:
    • Identify common processes that can be extracted into subflows.
    • Use subflows for repetitive tasks or processes shared across multiple flows.

4. Test Thoroughly

  • Description: Test your flows extensively using the Debug feature before activating them.
  • Benefits: Identifies and resolves errors or unexpected behavior before the flow goes live, ensuring reliability.
  • Tips:
    • Use a variety of test cases to cover all possible scenarios.
    • Test with different user profiles and permissions to ensure accessibility.

5. Use Error Handling

  • Description: Implement error handling to manage and log exceptions gracefully.
  • Benefits: Ensures that users receive helpful messages when something goes wrong and provides insights for troubleshooting.
  • Tips:
    • Use Fault connectors on elements that can fail, such as data operations.
    • Log errors to custom objects or send notifications to administrators.

6. Optimize for Performance

  • Description: Design flows to minimize performance impacts on your Salesforce org.
  • Benefits: Ensures that flows run efficiently and do not slow down the system.
  • Tips:
    • Use Get Records elements judiciously to avoid large data retrievals.
    • Minimize the number of elements in a single flow by using subflows and modular design.
    • Use Pause elements for long-running processes.

7. Document Your Flows

  • Description: Maintain documentation for each flow, including its purpose, logic, and any special considerations.
  • Benefits: Helps others understand, use, and maintain the flows, and serves as a reference for future updates.
  • Tips:
    • Include flow diagrams and screenshots.
    • Document any custom logic or external integrations.

8. Monitor and Maintain

  • Description: Regularly review and update your flows to ensure they remain aligned with business processes and system changes.
  • Benefits: Keeps your automations relevant and efficient as business needs evolve.
  • Tips:
    • Set up monitoring and logging to track flow performance and issues.
    • Periodically review and refactor flows to incorporate improvements and new features.

Summary of Best Practices

Best PracticeDescriptionBenefitsTips
Plan Before You BuildMap out your process before designing the flowClear understanding, efficient designUse flowcharts and diagrams
Use Descriptive NamesName flows and resources clearlyEasier to understand and maintainFollow naming conventions, provide detailed descriptions
Keep Flows ModularBreak down complex flows into subflowsSimplifies design, promotes reusabilityIdentify common processes for subflows
Test ThoroughlyTest flows extensively before activationEnsures reliabilityUse various test cases, test with different user profiles
Use Error HandlingImplement error handling and loggingManages exceptions gracefully, aids troubleshootingUse Fault connectors, log errors, send notifications
Optimize for PerformanceDesign flows to minimize performance impactsEnsures efficient flow executionMinimize large data retrievals, use subflows, add Pause elements
Document Your FlowsMaintain documentation for each flowHelps others understand and maintain flowsInclude diagrams, screenshots, document custom logic
Monitor and MaintainRegularly review and update flowsKeeps automations relevant and efficientSet up monitoring, periodically review and refactor flows

By following these best practices, you can create robust, efficient, and maintainable flows that effectively automate your business processes in Salesforce.

Troubleshooting Salesforce Flows

When working with Salesforce Flows, encountering issues is inevitable. Effective troubleshooting can help you quickly identify and resolve these issues to ensure your flows run smoothly. Here’s a guide to common problems and solutions in Salesforce Flows:

Common Issues and Solutions

  1. Flow Fails to Activate
  2. Flow Doesn't Produce Expected Results
  3. Flow Runs Slowly
  4. Errors in Data Operations
  5. Debugging with Flow Builder

1. Flow Fails to Activate

  • Symptoms: Error message during activation, flow cannot be saved or activated.
  • Possible Causes:
    • Validation Rules: The flow might be violating a validation rule.
    • Missing Required Fields: Required fields in Create or Update Records elements are not populated.
    • Incorrect Data Types: Mismatch between variable types and the data being used.
  • Solutions:
    • Check Validation Rules: Ensure that the data being processed complies with all validation rules.
    • Populate Required Fields: Verify that all required fields have values assigned to them.
    • Match Data Types: Ensure that the data types of variables match the expected types in each element.

2. Flow Doesn't Produce Expected Results

  • Symptoms: The flow runs but does not produce the desired output or behavior.
  • Possible Causes:
    • Logic Errors: Incorrect logic in Decision or Assignment elements.
    • Incorrect Variable Assignments: Variables not being set or updated correctly.
    • Faulty Conditions: Conditions in Decision elements not evaluating as expected.
  • Solutions:
    • Review Flow Logic: Carefully check the logic in Decision and Assignment elements.
    • Check Variable Assignments: Ensure that variables are being correctly assigned and updated.
    • Test Conditions: Verify that conditions in Decision elements are accurate and cover all possible scenarios.

3. Flow Runs Slowly

  • Symptoms: The flow takes a long time to execute or times out.
  • Possible Causes:
    • Large Data Sets: Processing large volumes of data in Get Records or Loop elements.
    • Complex Logic: Excessively complex logic or multiple nested loops.
    • External System Calls: Delays due to external system integrations or Apex actions.
  • Solutions:
    • Optimize Data Retrieval: Limit the number of records retrieved and processed.
    • Simplify Logic: Break down complex logic into simpler subflows.
    • Minimize External Calls: Reduce reliance on external system calls or optimize their execution.

4. Errors in Data Operations

  • Symptoms: Errors related to Create, Update, or Delete Records elements.
  • Possible Causes:
    • Record Locking: Records being accessed are locked by other processes.
    • Insufficient Permissions: The user running the flow does not have the required permissions.
    • Data Integrity Issues: Data violating integrity constraints, such as unique fields or foreign key references.
  • Solutions:
    • Handle Record Locking: Use Fault connectors to manage record locking issues and retry operations if necessary.
    • Check Permissions: Ensure that the flow’s running user has the necessary permissions to perform data operations.
    • Maintain Data Integrity: Validate and clean data to ensure it meets all integrity constraints.

5. Debugging with Flow Builder

  • Symptoms: General issues that require in-depth troubleshooting.
  • Possible Causes: Various issues related to logic, data, or external integrations.
  • Solutions:
    • Use the Debug Tool: Utilize Flow Builder’s Debug tool to test flows with different inputs and scenarios.
    • Analyze Debug Logs: Review the debug logs to understand the flow’s execution path and identify where issues occur.
    • Test Iteratively: Make small changes and test iteratively to isolate and resolve specific issues.

Troubleshooting Tips

  1. Use Fault Paths:

    • Description: Fault paths allow you to handle errors gracefully and provide fallback actions or notifications.
    • Implementation: Connect Fault paths to elements that may encounter errors, such as data operations or Apex actions.
  2. Log Errors:

    • Description: Logging errors helps you keep track of issues and analyze them later.
    • Implementation: Create custom objects to store error logs and use Create Records elements to log errors.
  3. Debug with Real Data:

    • Description: Testing with real data helps you understand how the flow behaves in actual scenarios.
    • Implementation: Use the Debug tool to run the flow with actual data inputs.
  4. Review Flow Versions:

    • Description: Reviewing previous versions can help you identify changes that introduced issues.
    • Implementation: Use the Flow Versions feature to compare different versions and rollback if necessary.
  5. Collaborate with Team:

    • Description: Collaborating with other Salesforce admins or developers can provide new perspectives and solutions.
    • Implementation: Share your flow and debug logs with your team for collaborative troubleshooting.

Summary of Troubleshooting Steps

IssueSymptomsPossible CausesSolutions
Flow Fails to ActivateError during activationValidation rules, missing fields, data type mismatchCheck validation rules, populate fields, match data types
Flow Doesn't Produce ResultsRuns but incorrect outputLogic errors, variable issues, faulty conditionsReview logic, check variable assignments, test conditions
Flow Runs SlowlySlow execution or timeoutsLarge data sets, complex logic, external callsOptimize data retrieval, simplify logic, minimize external calls
Errors in Data OperationsErrors in Create/Update/Delete RecordsRecord locking, insufficient permissions, data integrityHandle record locking, check permissions, maintain data integrity
General DebuggingVarious issuesLogic, data, integrationsUse Debug tool, analyze logs, test iteratively

By following these troubleshooting steps and tips, you can effectively identify and resolve issues in your Salesforce Flows, ensuring they run smoothly and efficiently.

Post a Comment

0 Comments