Skip to main content

Flows Calling Flows

The true power of Flow comes from learning how to compartmentalize your logic into specific, reusable Flows that can be used throughout your implementation. I'll cover the basics of how to do this as well as a few other techniques in this post.

Continuing on from the Launch a Flow From Process Builder or Visualforce post...

Last time we made a flow that counts 1 type of Beer and puts that count on the Brewery record. Let's transform that into a reusable flow so we can count all types of beer at the same time! We'll do this by making a master flow that calls our new and improved flow many times.

I'll also be showing a technique that will help you to prevent updating records that do not need to be updated. It's important to prevent Salesforce Automation from snowballing - ie. Process Builder fires a Flow to update a record which then triggers a Workflow Rule to update another field which then fires a Trigger to then... Yeah, you get it. It's messy. And very difficult to troubleshoot when errors occur in the future.

Before Starting the Video

Here's a link to an unmanaged package that contains of all the config I'll be using including the Process Builder, Flows and Visualforce Page. Feel free to install it in a Dev Org and follow along: Flows Calling Flows Config

Here's the Master Flow we ended up with

Here's the Visualforce Page we ended up with


Comments

Popular posts from this blog

Salesforce Lighting Migration: Plan for Success

In April 2018, I led the Salesforce Lightning Migration at Postmates. This is how I would do it over again if I could.


Define Goals The goals of a Lightning Migration are: Enable Lightning ExperienceConfigure Lightning ExperienceDocument all Salesforce processesCreate training and support materialsLightning Experience is adopted Easy enough right? Let's go though the plan to see how we accomplish each one. Enable Lightning Experience Just turn it on right? Well, kinda.
Although it may be controversial, I recommend turning it on and hiding the option from all users. This can be done by removing the Lightning Experience User permission from your custom profiles. 
And yes, turn it on in production
Why? You're going to turn it on anyway. Salesforce has declared this as the path forward, so you either turn it on now or wait until they flip the switch for you.
Plus, turning this on ahead of time will make deploying from a sandbox much easier. Trust me.
Goal #1 Enable Lightning Exp…

SOQL from the Command Line

SOQL and the Command Line go together better than peanut butter and jelly. Here's why.
Once upon a time, I got tired of running Salesforce Reports to get miscellaneous data. I found Workbench and started using their interface to run SOQL queries. This was great for a while, but I knew there was a better way.

Pro-tip with Workbench: If you set a browser bookmark after your query runs, you can return to that bookmark and it will re-run your query!

Enter the SFDX Command Line Interface (CLI). Get ready to take your productivity into hyperdrive! 🚀🚀🚀
sfdx force:data:soql:query If there's one command you learn, this is the one. All you have to do is pass a query string into the -q parameter and you're in business. Check it out:
-r | --resultformat This is my 2nd favorite thing. How often do you need to export a csv from Salesforce? And how annoying is it to make throwaway Salesforce reports each time? Yeah, it's the worst.
-r to the rescue! Just add "-r csv" to …

Why should I use SOQL?

You need data, fast!
Whether it's exporting a csv or answering a question, SOQL can get you the result much faster than creating a Salesforce report.

My top 3 reasons to use SOQL are:
Get data fastGet answers fastFlexible access Get Data Fast How often do you find yourself making a throwaway report to check what is happening in the system? For example, you updated your Lead routing and want to see if it's been assigning Leads as you expect. Well you could make a report, run it and review the results. Or you could run a SOQL query.
The benefits of running a SOQL query in this case is that you can retrieve different data sets much quicker. In a Salesforce report, you are stuck with the Report Type you selected when creating the report. With SOQL, you can traverse object relationships in a much more natural way. Get Answers Fast Have you ever been in a meeting and someone asks a data question that no one has the answer to? Well SOQL comes in handy here because you can run a quick …