Salesforce Flow

Salesforce Flow

Salesforce Flow is an automation tool within Salesforce that allows you to create processes to handle different tasks, guide users, and update data without writing much (or any) code. It’s a powerful way to automate business processes, improve efficiency, and ensure consistency in your Salesforce organization.

Types of Salesforce Flows

Salesforce Flows are categorized into several types based on how and when they are triggered. Here’s a breakdown of the main types:

1. Screen Flow

  • Purpose: Used to guide users step-by-step through a process, like filling out a form or updating a record.
  • Triggered By: User interaction.
  • Example Use Case:
    • A sales rep is guided to fill in specific details for a new lead.
    • Customer service agents can use it to follow a process when resolving an issue.
  • Key Feature: Includes screens, buttons, and inputs for user interaction.

2. Record-Triggered Flow

  • Purpose: Automatically triggered when a record is created, updated, or deleted.
  • Triggered By: Changes to Salesforce records.
  • Example Use Case:
    • Automatically send an email when an opportunity is closed.
    • Update related records when a record is updated.
  • Key Feature: Runs in the background without user interaction.

3. Schedule-Triggered Flow

  • Purpose: Runs at a specific time or on a recurring schedule.
  • Triggered By: A scheduled time (e.g., daily, weekly, or monthly).
  • Example Use Case:
    • Send a reminder email to customers about subscription renewals every Monday.
    • Weekly updates to calculate and log employee performance.
  • Key Feature: Ideal for batch processing or time-based tasks.

4. Auto-Launched Flow

  • Purpose: Runs without user interaction and is usually invoked by another process or tool.
  • Triggered By:
    • Processes like Process Builder or Apex.
    • Manual start by a developer or admin.
  • Example Use Case:
    • Automatically assign tasks when a new project is created.
    • Trigger complex business logic in combination with other automations.
  • Key Feature: Flexible and used in complex scenarios.

5. Platform Event-Triggered Flow

  • Purpose: Runs in response to a platform event.
  • Triggered By: Events occurring within or outside Salesforce.
  • Example Use Case:
    • Automatically process incoming data from an external system via events.
    • Notify teams when a specific condition is met in a connected app.
  • Key Feature: Integrates with external systems using platform events.

6. Login Flow

  • Purpose: Runs during the user login process to customize the experience.
  • Triggered By: User login.
  • Example Use Case:
    • Display company policies to users at login.
    • Verify users with additional questions for enhanced security.
  • Key Feature: Enhances user login workflows.

Components of Salesforce Flow

  • Regardless of the type, every Salesforce Flow has the following basic building blocks:

    1. Elements: Actions that the Flow performs, such as:
      • Screens: For user inputs.
      • Decisions: To apply conditions and logic.
      • Assignments: To update or store values.
      • Loops: To repeat actions.
      • Actions: Perform specific tasks like sending an email or posting a message.
    2. Resources: Variables, formulas, or constants that store or process data.
    3. Connectors: Define the order in which the elements are executed.

Here’s a detailed scenario question and step-by-step explanation of how to create a Record-Triggered Flow in Salesforce to update the Priority and Description fields on the Opportunity object based on the Amount.

Scenario Question

You are tasked with automating the prioritization of opportunities in Salesforce. A custom picklist field Priority (values: High Priority, Medium Priority, Low Priority) has been added to the Opportunity object.

Business Requirement:

  1. When a new Opportunity is created:
    • If the Amount is greater than or equal to 1,000,000, set the Priority field to High Priority and update the Description field with “High amount value opportunity is created with high priority.”
    • If the Amount is between 100,000 and 1,000,000, set the Priority field to Medium Priority and update the Description field with Medium amount value opportunity is created with medium priority
    • If the Amount is less than 100,000, set the Priority field to Low Priority.

Step-by-Step Explanation

Step 1: Create the Custom Field

  1. Go to Setup:
    • Click on the gear icon (top-right corner) and select Setup.
  2. Navigate to Object Manager:
    • In the Quick Find box, search for Opportunity.
    • Click on Opportunity.
  3. Create the Priority Field:
    • Go to Fields & Relationships and click New.
    • Select Picklist as the field type.
    • Enter the label as Opportunity Priority and add the values:

High Priority

Medium Priority

Low Priority

As given below in image:

        o Click Next, set field-level security, and add it to the appropriate page layouts.
        o Click Save.
4. (Optional) Add Description Field:
        o The Description field already exists on Opportunity by default. If it’s not visible on the page layout, ensure it’s            added.

Step 2: Create the Record-Triggered Flow

  1. Go to Flow Builder:
    • In Setup, search for Flows in the Quick Find box and click on Flows.
    • Click New Flow.

As given below in image:

2. Select Flow Type:
        o Choose Record-Triggered Flow and click Create.

3. Configure the Trigger:
      o Object: Select Opportunity.
      o Trigger: Select A record is created or updated.
      o Condition Requirements:
              Leave as ( All conditions are met “And”).
      o Optimize the Flow: Select Fast field update
      o Click Done.

Step 3: Add a Decision Element

  1. Drag and Drop the Decision Element:
    • From the toolbox, drag the Decision element onto the canvas.
  2. Label the Decision:
    • Name it Evaluate Opportunity Amount.
  3. Define Outcomes:
    • Add the following three outcomes:

 

Outcome 1: High Priority

      • Condition: Opportunity.Amount >= 1000000
        (Choose Amount → Operator: Greater than or equal to → Value: 1000000)

Outcome 2: Medium Priority

      • Condition: Opportunity.Amount >= 100000 AND Opportunity.Amount < 1000000
        (Add two conditions with “AND” logic)

Outcome 3: Low Priority

      • Condition: Opportunity.Amount < 100000

Note: It will be the default outcome

    • Click Done.

Step 4: Add Update Records Elements

For each decision outcome, add an Update Records element.

  1. For High Priority:
    • Drag Update Records onto the canvas.
    • Name it Set High Priority.
    • Record to Update: Select Use the record that triggered the flow.
    • Set Field Values:
      • Priority = High Priority.
      • Description = High-value opportunity is created.
    • Click Done.

2. For Medium Priority:
      o Drag another Update Records element.
      o Name it Set Medium Priority.
      o Record to Update: Select Use the record that triggered the flow.
      o Set Field Values:
              Priority = Medium Priority.
      o Click Done.

3. For Low Priority:
      o Drag another Update Records element.
      o Name it Set Low Priority.
      o Record to Update: Select Use the record that triggered the flow.
      o Set Field Values:
               Priority = Low Priority.
      o Click Done.

Note: It will be the default outcome

Step 5: Connect the Elements

  • Connect the Start element to the Evaluate Opportunity Amount (Decision).
  • Connect each Decision Outcome (High Priority, Medium Priority, Low Priority) to its corresponding Update Records element.

Step 6: Save and Activate

  1. Save the Flow:
    • Click on Save, and name the flow (e.g., “Set Opportunity Priority Based on Amount”).
    • Provide a description for documentation purposes.
  2. Activate the Flow:
    • Click Activate.

Testing the Flow

  1. Create Test Opportunities:
    • Go to the Opportunity tab in Salesforce.
    • Click New and create three Opportunities:

One with an Amount of 1,500,000 (Expected: High Priority).

One with an Amount of 500,000 (Expected: Medium Priority).

One with an Amount of 50,000 (Expected: Low Priority).

Practices Tasks:

  1. Create one screen flow to create related opportunity on Account object
  2. Create one record triggered flow
  3. Create on scheduled triggered flow

YouTube Reference: