Let It Flow (Automations Never Bothered Us Anyway) Every good Salesforce org uses automations—automatic processes that cut down on tasks that would otherwise need to be done manually. Salesforce admins have a whole suite of tools at their disposal to make these automations happen, but none more powerful than Flow. Flow extends other declarative solutions like Process Builder by giving admins the ability to automate the creation, updation and deletion of one or many records based on complex logic. Why Use Salesforce Flows? As an admin, Flow Builder gives you the power to design complex business automations without relying on Apex development or expensive third-party solutions. The power is in your hands! Using the Salesforce platform’s built-in tools means easier maintainability than custom code. Plus, since you’re building it yourself, you can perfectly tailor the Flows to meet your specific needs. Additionally, Flows keep getting better and more powerful with each Salesforce release. Now is a great time to learn how to use this tool because its capabilities and popularity are only going to increase. Types of Flow There are two types of Flows. They are both built directly in Flow Builder and the process for creating them is the same. Screen Flows interact directly with the user through one or more screens in a wizard-like interface. They can take user input and use that information within the Flow. Autolaunched Flows operate “behind the scenes” and can be configured to launch from a Process, another Flow, when a user clicks a button or link—or from an Apex class. Get to Know the Flow Builder To get started building Flows, simply go to “Flows” in Setup and click the “New Flow” button. When building a Flow, you’ll need to be familiar with Elements and Resources. These are found under the “Elements” and “Manager” tabs of the Toolbox, respectively. The Elements of a Flow are nodes you can place in the Flow builder that literally tell the Flow what to do. The Screen element is only available in Screen Flows. It allows you to design customized screens for a user to interact with that can display data dynamically and accept user input. Action and Subflow elements are used when you want the Flow to invoke Apex code or launch a separate Flow, passing in data from the running Flow. Logic elements include Assignment (assigning new values to fields to later be Updated), Decisions (specifying which path to take based on criteria), and Loops (allowing you to “loop through” a collection of records and process each one). More on that later. Data elements are the real meat and potatoes of your Flow. The Get Records element allows you to locate a single record or collection of records in your org in order to view or modify it. Create, Update and Delete Records elements do exactly what they sound like! To build a Flow, place the elements you need on the canvas, then click and drag from one element to another to create a path that determines the order that elements are processed in. Make sure to give the elements you create helpful names and descriptions! Resources in a Flow are values that can be referenced throughout the Flow. This includes variables, which are dynamic values that can be accessed and modified by the elements of your Flow. Think of each variable as a box that can hold one type of data. Some of your boxes might hold text, some might hold numbers, some might hold entire records, and so on. Records or fields from a Get Records element are saved as resources so that you can refer to them later in the Flow. Getting Loopy What makes Flows so powerful is their ability to write complex logic without writing any code. One tool for accomplishing this is the Loop element. Loops allow each record in a collection to be processed individually. Record Collections are a special type of variable that stores multiple records. A loop element takes each record in a collection, one at a time, through any nodes placed within the loop. In this simple example, the loop element is assigned a collection of records of a custom object. Each record from that collection moves through an Assignment element that updates certain fields, and then a second Assignment element that adds that record to a new collection. Later, outside of the loop, an Update Records element will process that new collection variable and save the updated records to Salesforce. Keep in mind that logic can be nested! In other words, you can have a loop within a loop, a decision element inside of a loop, or anything else that fits your business scenario. Best Practices You’re on your way to making awesome Flows that take repetitive tasks out of your users’ hands! On your journey to master Flow Builder, keep these best practices in mind: Always keep your “Data” elements outside of a loop. Get, Create, Update and Delete Records elements count towards Salesforce’s limits on DML statements in a single operation. Including them inside of a loop is a recipe for hitting those limits. Instead, use an Assignment node to assign the records to a collection, and then create/update/delete the whole collection outside of the loop. Document your elements and resources. Use those description fields! This will make the Flow easier to understand and maintain whether it’s you or another admin when the Flow needs to be updated. Use a consistent naming convention. When naming your elements and resources, develop a consistent naming convention to keep your Flow more organized and easier to follow. Never hard-code Salesforce IDs. IDs are org-specific and won’t be the same across production and different Sandboxes. Instead, creatively use variables, merge fields, and the Get Records element to ensure the appropriate records are found in every environment. Do You Want to Build a Flow, Man? At Bitwise Industries, we use a consultative approach to help you determine the best strategy to identify your challenges, implement appropriate solutions and enhance your systems. Want to fast track your Automations knowledge? Check out this quick, 4-minute read! If you’re interested in uncovering the tech possibilities available to your organization, click this link to schedule some time with one of our experts. This post was written by Joseph Wheelock, a triple-certified Salesforce Admin, nature-lover, musician and cat dad. Did you love this blog? Subscribe here for new Bitwise blog notifications.