Salesforce Flow Best Practices

Plan Plan and Plan

If you don't take anything else from here, trust me on this one, especially if you are a flow beginner. This part is so important and overlooked most of the time. I get it, we want to start building right away because it's fun and sometimes it might feel like a waste of time! But wouldn't you want to start on the right foot? Just get the basic requirements and draw that out on a piece of paper. It can be iterated upon based on feedback, which is the beauty of flows! Remember it doesn't have to be perfect.

Some tools/tips on planning:

  • Use whiteboard, online or in-person
  • Use miro, mindmaps, lucid-chart, or any visualization tool of your choice
  • Or just your notebook or scratchpad

Naming Conventions

Honestly, we have all done it. Test1, test2, FlowTest, etc especially when you are new and are not really worried about naming it right, you are trying to ‘get it to work’ and once it works, you don't want to touch it.

Bad naming conventions will definitely haunt you later and cause too many problems which can be avoided by simply taking a few seconds to name.

Most common places you can start to name them correctly:

  • Flow itself — eg: Account After Insert Flow, or Call Center Welcome Screen Flow, there are no rules but keep it consistent
  • Flow variables — you can use camelCasing here. eg: oppList, or opportunityList, accVar, firstName, etc
  • Elements like Screen or Get Record or Update — also camelCasing starting with a verb. eg: getAccountList, createOppty, capturePatientInfo, etc
  • Formula — eg: dateToday, constTerm, etc

Flow per object — Record triggered flows

  • How many flows per object: If you have complex requirements, you may end up having multiple flows on the same object, in different contexts Before/After Insert/Update, Delete. This is no issue in terms of performance besides, there is still no way as opposed to triggers to add them under one flow. Make sure you are very conscious of what is happening in all the other flows, especially if they are in the same context. If you have 2 flows both firing on Before Insert and the same condition, this can be an issue and you want to combine them. If you have 2 Before Insert flows but completely different entry criteria, it’s not a bad design and doesn't hurt performance. In fact, sometimes it’s best to keep it separate when you have different stakeholders and requirements so you are not impacting a different flow.
  • Use Criteria in your Flows: You need to always be asking this question to the business on when do you want to fire this. In flows, you can use criteria either directly on the start node or on decision nodes to go through different paths based on the outcome of a decision. Or a combination of both.
  • Check what other automation are present on that object like triggers, w workflows, processes.

Read on Order of Operation

Insert/Update/Delete inside a For loop

This is mostly an issue I notice from admins which is totally understandable because it's also an Apex concept where using DML inside a flow loop is forbidden. You might not notice any significant impact immediately or never if you will only ever update very few records at once. But once your org gets complex or you need to update potentially over 100 children records inside a loop, you will start seeing errors.

  • Make use of the Assignment element to assign values to a collection inside the loop instead of Insert or Update- shameless plug watch my video here
  • Be conscious that every database interaction you make counts towards the limits

Have Fun and play with flows, that's the best way to learn Flows! Do not be initimidated and rech out for help. There are tons of resources out there and folks ready to help you!

Note: Every org is different so you will have to play around and decide which one works best for you. Hopefully these gave you good pointers but definitely not an exahustive list.

My beginner Flow Playlist if you don't already know my channel.

Same topic in a video.

Please join the conversation here or comment with your thoughts! I will be sharing more so please follow if you like this.

--

--

--

Salesforce enthusiast, learning and sharing on the Platform, Architect at heart, love to help young women navigating in tech career

Love podcasts or audiobooks? Learn on the go with our new app.

SREcon17: Brave new world of site reliability engineering

Golang: Connecting to posgres using ssl

Microsoft Build 2019 Tech Keynote with Exec VP Scott Guthrie

I finally got my own test and I’m positive, but my only symptoms are that I have no taste or smell

How To Vim — Beginner Basics

AWS CLOUD+TERRAFORM+GIT:-End to End Static Website Automated Development Using Terraform with AWS

Measuring Software Delivery

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Pratima Shrivastav

Pratima Shrivastav

Salesforce enthusiast, learning and sharing on the Platform, Architect at heart, love to help young women navigating in tech career

More from Medium

SFDX+VSCode : Scratch Org Automation with VSCode Task

What is apex programming?

Salesforce deployment error | Picklist value : in picklist : not found

picklist value not found

How to Handle Loop Efficiently in Code Explained by Cloud Odyssey