A Guide to Flow for Beginners (with a Beginner-Friendly Exercise)

Starting with Flow can be scary. It's imitating! You know it's an important part of being a Salesforce Admin, but if we're really being honest, all those actions and loops and decisions are a whole world of confusion. Perhaps being a developer would help? No! Stop thinking like that. Getting started in Flow can be easy and fun; just follow these steps...
What we're creating:
Imagine this: sales rep Travis wants to be reminded to follow up with Leads based on their rating; Cold, Warm, or Hot. Our Task today is to automatically create a Task that is associated with the Lead. If the Lead Rating is Cold, we want the Task to be due in 2 weeks. If it's Warm, we want the Task to be due in  1 week. If it's Hot, the Task should be due in 3 days.
The Steps:

PART 1 - Setting up the Flow

New Flow
Why are we doing this? To put it bluntly, we have to! If we want to create a new Flow we have to go through these steps to get it started.
  1. Open up Flow in Setup and select "New Flow" - yep, we're going there 💪
  2. Choose "Record-Triggered Flow" 
  3. Configure the start of your Flow - see if you can do this without following looking at the steps below first!
    1. Object: Lead
    2. Trigger the Flow When: A record is created or updated
    3. Condition Requirements: Any condition is met (OR)
      1. Condition 1: Rating Equals Hot
      2. Condition 2: Rating Equals Warm
      3. Condition 3: Rating Equals Cold
    4. When to Run the Flow for Updated Records: Every time a record is updated and meets the condition requirements
      1. NOTE: What's the difference between "Every time a record is updated and meets the condition requirements" and "Only when a record is updated to meet the condition requirements"? If you select Only when it means that the Flow will only run when a record goes from not meeting the requirements to meeting the condition requirements.
    5. Optimize the Flow for: Actions and Related Records
Wait, what did we just do? We've just set the starting requirements for the Flow. We've said that we're working only on Leads and that for a Lead record to enter in the Flow, it needs to have a rating of either Cold, Warm, or Hot. If a Lead doesn't have a rating, it won't trigger this Flow. We've said that the Flow should run every time a record meets these requirements; not just going from no rating to Cold, Warm, or Hot. The Flow should run if we change the rating from Cold to Warm as well.

PART 2 - Decide if the Lead has a Hot, Warm, or Cold rating.

Why are we doing this? We want to create a different Task depending on whether the rating is Cold, Warm, or Hot. So we need to have some way of pointing the Flow down a different path depending on the rating value. Kind of like a junction in a road. We're creating a junction for ratings.
Decision Element Flow
  1. Add the next element to your Flow. Scroll down and select "Decision".
  2. Name your Decision something useful. I went with: "Rating Field Value"
  3. Give it a useful description. A good question to ask yourself when writing descriptions is "Why does this exist?" (don't be lazy now, all the best Admins give good descriptions)
  4. For the first Outcome:
    1. Label: Cold Rating
    2. Condition Requirements to Execute Outcome: All Conditions Are Met (AND)
    3. Condition: Record > Rating Equals Cold
    4. When to Execute Outcome: Only if the record that triggered the flow to run is updated to meet the condition requirements.

      NOTE: Why didn't we choose "If the condition requirements are met"? Because that would run this particular outcome every time the record was updated and had a rating of cold, even if the rating field wasn't changed. Eg. you update the name of the Lead. The rating is already cold. You don't change the rating. You save the record. Boom. It will trigger this outcome. This is bad because we could end up with 20 of the same Task on the Lead without ever changing the rating at all.
  5. Next to OUTCOME ORDER you'll see a little "+" button. Click that to create your second Outcome.
  6. Repeat the steps for the first outcome, but change all the Cold values to Warm.
  7. Create your third Outcome by repeating the steps again, but changing all the Warm values to Hot.
  8. Click Done.
Wait, what did we just do? We just created a decision which opens up different paths depending on the Rating value of the Lead. If the Rating is Cold, it will go down Path 1. If it's Warm, Path 2. We also made sure that the Lead record would only go down these paths if the rating field itself was changed, instead of it going down these paths anytime a random update to the Lead record was made.

Outcome Element Flow


PART 3 - Create your new Task!

Why are we doing this? The whole purpose of this Flow is to create a new Task for the Lead owner depending on the Rating of the Lead. So this is where we create the Task. Questions? Nope? Okay. Let's go.
Create Element Flow
  1. Under your Cold Rating, create a new element. Select "Create Records'
  2. Give your element a useful Name. I went with "Create Cold Task"
  3. Give your element a useful Description (Yes, I'm serious. Descriptions are important, even when you think it's obvious. Remember, ask yourself "Why does this exist?" then just write down your answer.)
  4. How Many Records to Create: One
  5. How to Set the Record Fields: Use separate resources and literal values

    NOTE: What does it mean "Use all values from a record"? When we select this option it means we can create a new record using all the existing field values of an existing record. The existing record could be the one that triggered the Flow, or you can create a record variable within the Flow, fill it with all the values you want to use, and then use that here. This would be useful if you have used Get Records, and you want to clone that record directly or after some modification. For example, creating test records based on an existing Lead record would be a good use of this.
  6. Create a Record of This Object: Task
  7. Field 1:
    1. Field: Subject
    2. Value: New Resource:
      1. Resource Type: Text Template
      2. API Name:  Cold Task Subject
      3. Description: The subject line for creating a Tasks from a Cold Lead Rating.
      4. Body: Choose an awesome subject line for your Task. I went with: Lead Rating: COLD 🥶. Follow up in 2 weeks!
  8. Field 2:
    1. Field: OwnerId
    2. Value: Record > OwnerId {!$Record.OwnerId}
  9. Field 3:
    1. Field: WhoId
    2. Value: Record >Id {!$Record.Id}
      1. NOTE: What does "WhoId" even mean? We use WhoId when we want to relate a record to a person object; think of Leads and Contacts. These are representatives of people. If we wanted to related this Task to a non-person; think of Opportunities or Accounts, then we'd use the WhatId.
  10. Field 4:
    1. Field: ActivityDate
    2. Value: New Resource:
      1. Resource Type: Formula
      2. API Name: Cold Task Due Date
      3. Description: The due date for Tasks created from a Cold Lead Rating.
      4. Data Type: Date
      5. Formula: TODAY() + 14
  11. Click Done.


Decision Paths with Create Record Element Flow


Wait, what did we just do? We set up the instructions for creating a Task for Leads with a Cold Rating. We gave the Task a subject, assigned it to the Lead Owner, related it to the Lead that triggered the Flow, and made the Due Date two weeks from the day the Flow is triggered.

PART 4 - Create ALL the Tasks!

Why are we doing this? We've created one Task record for the Cold rated Leads. Now it's time to do the same for Warm and Hot!
Copy Elements Flow Salesforce
  1. Click on the "Create Cold Task" element we just made and select the "Copy Element" option.
  2. Under the Warm Rating path, click on the add element "+" symbol and select "Paste Copied Elements"
  3. Edit your pasted element and change all the Cold values to Warm. This includes:
    1. The Label of the element
    2. The API Name of the element
    3. The Description of the element
    4. The Subject field (you'll need to create a new Text Template resource, just like we did for the Cold Task.
    5. The Activity Date field (you'll need to create a new Date Formula resource. Instead of it being due in 2 weeks, it should be due 1 week from the day the Flow is triggered).
  4. Repeat these steps for the 'Create Hot Task' element in the Hot Rating path. Remember that for the Hot Task, it should be due 3 days from the day the Flow is triggered.


All Create Record Elements Flow Salesforce
Wait, what did we just do? We set up the creation of Task records for Leads with Cold, Warm, and Hot ratings. Whohoo! We're almost ready to go!

PART 5 - Debug

Why are we doing this? It's super important that we debug any Flow we create first before we activate it. Because Flows can alter thousands of records at once, debugging them first is vital to avoid any large scale Flow disasters.
Salesforce Flow Debug Log
  1. The first thing we need to do is save our Flow. Click the big blue "Save" button in the top right corner.
  2. Give it a good Label and Description. Something like "Lead Task Automation based on Rating". And don't forget that description!
  3. Click "Save".
  4. Now that it's saved, we can go ahead and debug it. Click the "Debug" button in the top right.
  5. Leave everything as it is - just make sure that the "Run the Flow As If the Record Is" option is set to "Created".
  6. Choose an existing Lead in your org that you know has a Rating field. In this debug round, we're pretending that this Lead has just been created from scratch.
  7. Click "Run".
  8. Expand your Debug Log on the right-hand side of your screen and read through everything. Is it what you expected? You can also look for the "Completed" green bubble at the top of your screen.
  9. Run your Debug again, but this time change the "Run the Flow As If the Record Is" option to "Updated". Scroll down and change the rating value to something different. Click "Run" and analyse the result!
Other Debug scenarios you should try:
  1. With the "Run the Flow As If the Record Is" option to "Updated" try it with Rating as Cold, Warm, and Hot. It should go down the appropriate paths for each Rating value and create the right Task records.
  2. With the "Run the Flow As If the Record Is" option still set to "Updated", try leaving the Rating as it is and updating another random field, like Name. It shouldn't create any new Tasks, and instead, go down the empty "Default" path.
  3. With the "Run the Flow As If the Record Is" option to "Created" try it with Rating as Cold, Warm, and Hot. It should go down the appropriate paths for each Rating value and create the right Task records.


PART 6: Activate and Test!

Why are we doing this? The final step is to activate the whole thing - exciting! Even with all our awesome debugging, it's still important to test it in an App as soon as it's activated to make sure there's nothing we missed. That way we can always quickly deactivate it straight away if we realise there's something wrong.
  1. Click "Activate" in the top right corner
  2. Open up your Sales App and create a new Lead.
  3. Set the Rating to Hot.
  4. Check for your new Task record!
  5. You should try this for all 3 Rating values, and for updating Leads as well - just like we did when we were Debugging.



Final Flow Result


Final thoughts
Congratulations! You've reached the end of your very first Flow. I hope this was a useful experience for you to get started in what can often feel like a scary and intimidating area of Salesforce. If you're looking for additional challenges, try these variations below:
Variations of the exercise:
  1. Send an automatic email to the Lead owner instead of creating a new Task record. Have the email include all sorts of juicy fields from the Lead, like Name, Rating, Company, and Source.
  2. When a Lead rating is updated, search for all other Leads of the same rating and include the total number in your Task description.
Common Problems:
If you're Task record Subject includes HTML tags like "<p>", go back into your Flow and update your Subject Text Template. Select the "View as Plain Text" option and then remove any HTML tags that you see. Click Done, and Save and Activate your Flow again.
Common HTML Tag Problem Text Template Flow
Common HTML Tag Problem Text Template Flow Solution