Using Flows to Update a Lead Status
In our last tutorial, we learn how to start a flow, and create a custom button on the lead for easy access. Today we are going to build on what we’ve’ started and expand our flow process.
Flows are a multi faceted tool that you can utilize in Salesforce to achieve many different goals. The flow builder is capable of many things, whether it be directly altering records or performing actions based on subsequent actions.
Today we are going to start with a very basic task using flows, that can come in handy in many different situations. We are going to walk through updating a lead to a certain status based on how you go through a flow.
First, navigate to “Flows” which can be found under “Workflow & Approvals” in Setup. What we want to do now is start a new flow, so that we may start with a blank slate.
To the left, navigate to the menu to the left, and under Pallette, you will be able to scroll through the options, until you eventually see “Record Update”, among the various other tools we have at our disposal.
But before we actually implement the use of a record update, we need to build a flow first that we can build our record update logic off of.
To keep it simple, we will make a small questionnaire that will be used by your company’s intakers to essentially determine whether a leader is qualified or disqualified.
Let’s begin by adding a “Screen” which is the main building block that allows you to interact with flows. You can find “Screen” under “User Interface” in your Pallette.
For our first screen, let’s just create a generic welcome screen to let our intakers know what flow they have accessed and give them a basic message before continuing through the process. We can achieve this by adding a “Display Text” that essentially make a custom text that you can modify and style, but cannot be interacted with.
I’ve gone ahead and added a basic message that will segway our intakers into the flow.
Now it’s time to add our second screen. Drag a 2nd screen near your welcome screen. Remember we are essentially building a flow chart, so it’s important to keep it as organized as possible.
Let’s go ahead and call this screen “Intake Step 1”. It’s important to keep your names as short and detailed as you can make them, as your flows get bigger, naming organization is paramount to keeping your sanity so you don’t have to sift through your flow aimlessly when trying to track down a specific item.
So the purpose of this flow is to help our intakers determine whether volunteers qualify to join the space cadet program and defend earth against invaders. In order to do that we need to be able to interact with a few questions to determine whether they are qualified to do so or not.
Let’s add a radio button field onto our screen, we are going to utilize this to ask a yes or no question. Let’s go ahead and label our field with our first question, “Are You Capable Of Using A Blaster Rifle?”. We want to make sure our volunteers are capable of using futuristic weaponry.
Now that we have the field, we need to add some answers, we do this by using “Choice Fields”. Since we haven’t created a bank yet in the dropdown, click “CREATE NEW”, and choose “Choice”.
Make sure your label is “Yes” and for the sake of this exercise our Unique Name and Stored Value will be the same. Repeat the process to also make a “No” option.
Now you can see on the right under our fields that our first question now has a yes or no option.
Let’s go ahead and ask our second question. Let’s ask if our volunteer knows how to fly a spaceship. Remember, what you use as your label is what you will see in the actual flow.
Now since we are asking another Yes or No question, let’s go ahead and make this another radio button. Now since we have already created a bank of “Yes” and “No” for our previous question, they are now stored in our bank and we can reuse these throughout the flow. Instead of clicking “CREATE NEW”, under the “CHOICES” dropdown, you will already see the yes and no we created earlier. Go ahead and recreate the two answer options like we did for the previous question.
Now that we have our first screen complete, we need to connect it to our welcome screen. Do so by dragging the small square on the welcome screen box and connect it to the qualifications screen box. This will now “connect” the screens with an arrow that shows in which way the flow is directed
.
Now before we add any logic to our completed screen, let’s think ahead to what we want it to interact with.
Let’s add not one, but two end screens, since we have two outcomes. We will have a qualified end screen, and a disqualified end screen. I went ahead and called mine “Disqualified End” and “Qualified End”
Go ahead and drag 2 more screens into the flow, remember keep it visually organized.
Before we can determine what goes on our end screens, we need to first think about our flow process and what the qualification questions are meant to determine.
Let’s say our business process is to determine if a cadet is qualified is that they must be both proficient with a blaster rifle and an ace pilot. That would mean that BOTH questions must be answered yes for a cadet to be qualified. Any other combination wouldn’t make the cut and therefore, they would be disqualified.
So how do we implement this logic? First, we need to put in a place a mechanism that determines which end screen you end up on. We will use a decision to do this. A decision is a building block where you can use logic to determine which way you go through your flow and determine what actions are taken.
Let’s drag our decision in between our qualification screen and our end screens. We want to give our decision a descriptive name that relates to what it is interacting with. So let’s call it “Qualification Screen Decision”.
A decision can harbor multiple “Outcomes” which you can see on the left. You can use outcomes to have the decision prepare for when you have different combinations of answers that may lead to different actions. You are also supplied with a default outcome that triggers if none of your custom outcomes are true.
For this situation we will only need one outcome, and then we will leverage the default outcome. In order to be in line with our business process of requiring cadets to be good with a blaster and fly, both questions need to be answered “Yes”. Name your outcome something descriptively, such as “Cadet Is Qualified Outcome”. You will find the questions you made on the previous screen under Screen Choice Fields. Make sure both answer values are “Yes”.
Now since we only have one outcome, and are going to use the default outcome for anything other answer combination that isn’t Yes & Yes, let’s go ahead and rename it “Cadet Is Disqualified Outcome”.
So now that we have a functioning decision, we need to properly connect it within our flow. Drag the arrow from qualification screen to the decision, and then drag your decision to both end screens. When you have more than 1 if will give you a choice when you connect the points.
Now that we understand what each end screen is meant for, let’s go ahead and add some display text to each end screen. On our qualified screen let’s leave a message that let’s our intaker know the cadet has been qualified, and vice versa for our disqualified volunteers.
“Please inform and congratulate our volunteer and let them know that they will be joining our forces. “
“Please apologize and inform our volunteer that they didn’t quite make the cut. Please encourage them to return once they have hardened their skills.”
Now that all of our screens are completed, we have a functioning decision, it’s time to add in our record update logic, because that’s the whole point of this flow intake right? Now there are several ways to do this, we could utilize another decision, we could leverage the assignment tools, but for the sake of keeping this simple we will be adding a record update after each end screen.
Now in order for us to interact with the record we want to update, we need to add in a sObject Variable that allows us to interact with the lead object.
So let’s name it “LeadSObject”
We want to Update the “Lead” object
Now this is where the sObject comes in. We want to give our record update criteria on what lead we want to update. Now to update the specific record we launched from, we can use a filter, and to do this we will leverage the Id field.
Go ahead and drag a “Record Update” screen , and let’s name it “Lead Status Qualified Update”
Under field choose “Id”, and under value use “{!varLeadId}” which is our variable we created in our last tutorial to reference the record we launched from instead of a piece of static data. This associates our filter criteria to match the Id of the lead we launched the flow from, and will essentially update the original lead we are working with.
Under the actual field we want to update, choose “Status” and make the value say “Qualified”.
Be careful, if you do not have the value “Qualified” & “Disqualified” already in your picklist values for Lead Status, it will trigger an error during the flow. You ALWAYS need to have matching values in your flow/object if you are going to have them interact with each other in the flow.
Now you can repeat this process for our other end result. A quick way to do this is to copy and paste the Qualified record update and change the status value to “Disqualified”. It’s an easy way to save time.
Now to finish our flow nicely, let’s add a thank you screen regardless of decision. Add another display screen, with display text
“Thank you for taking the time to apply with us. We hope our survey was to your liking.”.
Make sure that both record updates point to our new thank you screen.
This is a very simple flow, that highlights the possibilities of what you can do. Stay tuned for more flow tutorials. Our academy is bound to grow and our business needs are bound to change!
Recent Comments