Salesforce Visual Workflow – Getting Started

By

Intro by Mike: This week it’s my pleasure to introduce you to one of the smartest problem-solvers I know. Last year at the Dreamforce to you event in Orlando I was lucky enough to meet Keith Sadler, Consultant at Appirio. Over a few beers we had a great discussion about reporting, workflows, and why Sriracha rules. He’s got crazy skills when it comes to reporting and a vast knowledge of making the Salesforce platform work in some inventive ways. A while back I asked Keith to write the definitive post that would show ButtonClick Admins the power of using flow and solve a real-world problem. I’m a huge fan of Salesforce Visual Workflow, and after reading this post you will have a useful functioning Salesforce Visual Workflow that will make you a rockstar today. (Tweet this)


Every ButtonClick Admin has done it at some point. You work with your web person to set up a Contact Us page (web-to-lead) and a support page (web-to-case). Then as you are all ready to kick back with your favorite beverage, glowing in your accomplishment, you get a dreaded phone call- Cases are coming in as Leads. The reality is this- customers will enter data to get in touch with you on the first page they find- regardless of what it’s intent is. Now you’re stuck with a lead that should be a case and a sales team that’s mad at you. Prior to Salesforce Visual Workflow, you had to turn to a developer. But Flow is a ButtonClick Admins best friend. So rather than reading about the Tip Calculator in the Salesforce Visual Workflow Implementation Guide, let’s solve some real-world problems and unlock the power of flow.

Part 1 – Create Our Flow

  • The first thing that we will want to do is create a new Flow by going to Setup | Create | Workflows and Approvals | Flows
  • Click the “New Flow” button, this will take you directly into the Flow Designer
  • You will first notice that the “Save” buttons are grayed out.  This is because you do not have any elements in your Flow yet.
  • Click and drag the Step element from the palette in the left pane into the canvas on the right.  The Step element works only as a placeholder in case you want to build out your Flow before you actually add fields and logic.
  • Name the Step Element “Display Case”, and add a description like “Displays Case Detail.” Then click Ok.
  • Go ahead and drag this to the bottom of the canvas, as this will actually be the final step in our Flow.  Once this is complete you can now save your Flow, and name it anything you would like!

 

Salesforce Visual Workflow- Keith Sadler

 

Part 2 – Building Our Flow – Get Our Lead Data!

When building a flow, we will always start off with a “Start Element.”  With our Flow, the first thing we need to do is get data from the Lead that we will put  the custom button on to launch the Flow.  We can do this by utilizing the Record Lookup element, as well as the Lead ID. In order to utilize the Lead ID, we must first create a Variable to store the Lead ID, which will be passed to the Flow when it is launched.  Think of a Variable as a data field on an object.  All a Variable does is store data, and reuses it in other areas throughout your Flow when needed.

  • Click on the Resources tab on the left pane, and double click on Variables.  This will create a new Variable, which can be reused in the Flow.
    • Name this Variable “Lead ID”, and set Input/Output Type to “Input Only”, leave the Data Type Text, and click Ok.  This setting allows you to pass the value through URL.
  • Next we need to add a Record Lookup element to the canvas, as this will be the start of our Flow.  This is how we will fetch and store the lead data in order to create a case out of it.
    • Click Palette in the left pane, and drag Record Lookup onto the canvas.
    • Name this “Lead Lookup”
    • In the Filters and Assignments section, Choose Lead from the Lookup dropdown (this is the object that we are performing a lookup to) and in the Field, Operators, Value section we want “ID equals {!LeadID}”- this is where the Lead ID Variable we just created comes into play.
    • The point to this is to set filters so that the lookup knows exactly which record to find. So scroll down to the “Assign the Record’s fields to Variables” section. This is the section where you can assign data from the lead record to Variables in your Flow.
    • Again, in the left drop down, the lead fields exist.  In the right column are the Variables in our Flow that we can map the values to.   Instead of pre-creating Variables, you will notice that we can do this on the fly!
        • In the first left drop down, type Name and select it.
          • In the Right drop down, click Create New then Variable.  Name Variable “LeadName” and leave the type as Text.
        • Click “Add Row” then repeat the step above for additional fields that you will map to the case record, Creating a new variable for each. When finished your screen will look like the picture below.
          • Email (Variable named LeadEmail)
          • Description (Variable named LeadDescription)
          • When you are done click “Ok” to take you back to the canvas.

Salesforce Visual Workflow- Keith Sadler

 

Part 3 – Create our Case and Display Values

Now that we have the lead fields stored into Variables in our Flow, we are able to create a case record with this data.  To do this, we will use the Record Create element.

  • Drag a Record Create element onto the canvas underneath our Lead Lookup.
    • Name this “Create Case”
    • In the Assignment section set the following
      • Create: Case (because we are creating a case record)
      • Now we will map the case fields to existing Variables that we stored from the Lead Lookup.  We are going to map to the fields on the Case that are typically filled out when a Web to Case is created (Web Name, Web Email, Description).  The API names for Web Name and Web Email are SuppliedName & SuppliedEmail.
        • Map SuppliedName to {!LeadName}
        • Map SuppliedEmail to {!LeadEmail}
        • Map Description to {!LeadDescription}
      • Finally, we have the option to store the ID of the case that is created into a Variable.  If you remember, the shortcut, you can create a new variable on the fly in the dropdown.  Name this Variable “{!CaseID}”.

Salesforce Visual Workflow- Keith Sadler

  • Now that we have the case created, we can create display text that will tell the end user a case has been created, and will show the ID.
    • In the step element, click the green arrows that have the “Convert Element” hover text.  This is to change this from a placeholder to an actual User Interface display.
    • First set the Navigation Options to “Don’t show finish button.”  We do this so that the Flow does not reset itself when the user is finished.
    • Click the “Add a Field” tab
    • Drag the “Display Text” field from left into the right hand Pane.  This is how we are going to add text that will display to the end user that a case has been created.
    • Click on the Display Text field that you dragged to the right.  You will notice that this can be named as well.  Name this “CaseCreatedScreen”.
    • There is also a text box below.  The text entered into this box will be displayed to the end user on this screen.  In the resources drop down, you will see that you have access to the variables you have created.  You can add text such as the one supplied below. When you are done click Ok.

“Congrats you have created a case with following data:

Name: {!LeadName}

Email: {!LeadEmail}

Description: {!LeadDescription}

CaseID: {!CaseID}

You may now close the window”

  • OK now that this has been saved, you are able to start connect the Elements on the Canvass.
    • The first thing you need to do is set a “Start Element” so that the Flow knows where to begin.  Click on the green circle with arrow pointing down on the Lead Lookup.
    • Next, drag and drop the connector arrows in a single line so that your Flow looks like the image below.
    • Then Click Save.

Salesforce Visual Workflow- Keith Sadler

Part 4 – Activate Flow and Build Button

All Flows created must be activated in order to use- just the same as any Workflow has to be Activated.  Also, please remember that users must have Flow User checked in their user record in order to run this. If you forgot this they won’t get to revel in the awesomeness we just created.

  • Activate your Flow
    • Once you close out of your Flow and are on the Flow detail page, click the “Activate” link next to the version you would like to have active (only one version can be active at any given time).
  • Create Custom Button for Flow
    • On the Flow detail page, you will notice a field “URL.”  Copy this URL as we will need this for the button.
    • Go to Customize | Leads | Buttons and Links, then click on “New”
    • In the Custom Buttons and Settings list click “New” and create a button with the following settings:
      • Name “Create Case”
      • Set as Detail Page Button
      • Display in a New Window
      • Content Source = URL
      • the URL should be”{YourFlowURL}?LeadID={!Lead.Id}”
      • Replace the {YourFlowURL} with the URL that you copied.  You will notice that the ?varLeadID is the Variable we created for LeadID, and we are passing in the Lead ID.

Step 5 Button URL : Salesforce Visual Workflow- Keith Sadler

      • Save this, and add to your Lead page layout, and we should be good to go run the Flow
      • Once the you click the Create Case button, a popup window should appear with the Display Text that you added in the last step of the Flow.

Salesforce Visual Workflow- Keith Sadler

  This was a quick and easy way to show you how Flow can be used a little outside the box.  Keep in mind that there are many things that could be added to this Flow in order to enhance this. Some additional things we could do:

  • Use Record Lookups to find an existing contact based on Lead Email, and attach to the case (similar to Web to Case)
  • Use Record Updates to update the Lead record status, or even use a Record Delete to delete the lead completely.
  • Use an Apex call out to invoke assignment rules for the case that was created
  • Use Constants to set other fields on the case such as Status, Subject, Origin, etc.

So that’s Flow, it gives us the ability to take Lead data and turn it into a Case. There is no other tool that ButtonClick Admins can turn to that would this without jumping off the code cliff. I hope you found this post useful and gave you a great example that any ButtonClick Admin could implement today. If you want to dive deeper into Flow check out this “Getting Started Pack” from Salesforce Labs. And if I see you at Dreamforce this year, I’ll take a hearty oatmeal stout in trade for a story about how you use Flow. Deal?

Choosing the Right Automation Tool

Right now is a great time to be a Salesforce Admin. With Lightning Process Builder, Workflow Rules, Visual Workflow, and Approval Processes, we have many great automation tools in our utility belt. As a Productivity Protector we are often working to streamline business process and deliver real business value. And if you watch any superhero […]

READ MORE

Salesforce Visual Workflow – Advanced Flows

‘For the second part of the Salesforce Visual Workflow tutorial, I’ve asked Keith Sadler, Consultant (and Flow guru) from Appirio to return and expand on some really cool functionality and advanced features. We are going to build off of the original Flow that was designed for creating a Case from a Lead record that was accidentally […]

READ MORE
A Salesforce Admin's Guide to TrailblazerDX 2024.

A Salesforce Admin’s Guide to TrailblazerDX 2024

The Trailblazer community is coming back together on March 6-7, 2024, in San Francisco and on Salesforce+ for TrailblazerDX 2024—join us! Generative artificial intelligence (AI) is revolutionizing application development, creating the most significant shift and opportunities for both admins and developers in decades. At TDX, you’ll learn to supercharge user productivity, automate business processes, and […]

READ MORE