Lightning Components in Flow!

In the Spring 18 release, Salesforce introduced the ability to show a Lightning Component inside a Flow screen.  It took me a while to be able to play around with this, but I am VERY excited for this!  This is not for first time Flow creators.  If this is your first time with Flows, look through some of the other posts on this blog in Learning Flow, Part 1.  But if you have some Flow background, get excited for Lightning Components in Flow screens!  Before we get started, I want to break down a few questions that you might have as I had them as well.

First Question:  Lightning Components mean code, why would we use them in a Flow?  That is correct, it is code.  I think of it like this.  Let’s take the example of an Account List.  The Lightning Component displays the Account List, however, you are controlling the logic to get the list in the Flow.  So, this means you’re not having to write code to create an account list or the logic, an admin controls that in the Flow, but the displaying of a list, Flows are not good at, so being able to send this to a Lightning Component to display is a lot easier than integrating with a Visualforce Page or writing everything in code.

Second Question:  Aren’t Lightning Components hard?  Lightning Components do mean code, but if you can put together a Flow, you can start to understand the logic for Lightning Components.  With something like showing a list of Accounts, the code required is very easy.  Salesforce has done a GREAT job expanding the base components for Lightning Components.  What’s a base component?  Think about the Dynamic Picklist Choice in Flows.  There would be a LOT of code to be able to get that done.  But Salesforce made it very easy and allows you to just select the Object and Field.  Base Components are similar, they are building blocks of Lightning Components, like the Dynamic Picklist Choice is in a Flow, and Salesforce takes care of the heavy code, so you just need to let them know a few key values to have their code run in the background.

Third Question:  Doesn’t this belong in a development blog?  NO!  I know you can do this!  As you’re learning Flow, you’re learning some of the logic of development.  This post will help you to expand just a little bit beyond Admin, to what some might call Adminvelopment, where you start to dabble in development.  The Lightning Component in this post is very lightweight, we are not going to have a controller or call apex, we are just going to display a list of Accounts and send that list from the Flow to the Lightning Component.

Ok, so where did this post come from?  For that, I have to thank Jocelyn Fennewald and Salesforce Saturday.  If you haven’t been to a Salesforce Saturday, you should attend.  What is it you ask?  A bunch of Salesforce people hanging out on Saturday and talking about Salesforce and maybe doing some trailhead.  Why should you go?  Because you never know what you’ll learn, where the conversation goes, or in this instance, what you’ll be able to help someone with and be inspired to learn something new.

So what is this post about?  Great question.  Jocelyn asked me if it was possible to use Flows to be able to create a way for a User to be able to look for referral accounts that match a User’s criteria.  Flow is great to be able to get the Account List based on a a few variables, but showing that list in Flow, well, that’s where the Lightning Components in a Flow screen come in handy!  What this post will help you learn is taking input from a User, finding a list of Accounts that match, and displaying those Accounts back to the User.  We’ll expand upon it in another post, being able to select records in the list and do something with them, but for this post, we’ll stick to the simple idea of displaying a list of Accounts. Continue reading

Loop Through a Collection Variable and Create a Roll Up Summary – Learning Flow 2.B

Welcome to part 2.B of the Learning Flow series where you’ll learn how to loop through a collection variable and create a roll up summary.  As part of the Learning Flow series, this post adds on to 2.A taking you through the Quote Line Item part of a Flow to help your Users build a Quote.

For this section, the business has requested that the Quote store the total number of items purchased.  You have two products, one that is sold in cases, with 12 items per case, and one that is sold in packs, with 3 items per pack.  A typical role up summary isn’t available since the quantity doesn’t include the number of units and the number of units doesn’t include the quantity calculation.  Here is a mathematical view.

Product X – Sold by the case – 12 Items per case

Product Y – Sold by the pack – 3 Items per pack

Order A: quantity 5 of Product X, quantity 3 of Product Y

A roll up summary of Quantity would be 8 and Items would be 15.  Now, you could create a new field on the Product Line Item, total units, and have that roll up to the Quote in another field, total units.  Although that’s possible, imagine that the company is out of Roll Up fields for the Quote object.  Flows to the rescue!

Continue reading

Create Line Items Using Flow – Learning Flow 2.A

This is the first post in the second part of the Learning Flow series.  In this part of the Learning Flow series, you’ll learn how to add Line Items using Pricebooks.  Although this will eventually tie to Quotes as part of the Learning Flow series, it also applies to Opportunity Products (Line Items) and Order Products (Line Items).  You’ve already shown the Pricebooks to your Users in the Quote Entry Flow, so now you’ll need to display the Products in the Pricebook for your Users to select.

There are a few things you need to do before creating the Quote Line Item Flow.  Go to the Setup menu, then in the search bar enter Critical Updates and click on Critical Updates.  There are two Critical Updates that you need to Activate.  The first is the one that says Flow Creators Receive Email for Each Unhandled Fault (so you get notified on faults!) and the second is Behavior Change for Default Values in Flow Screen Fields.  The behavior change is very important as you’ll see later.  Click Activate next to both of them.

Flow Critical Updates

Now, it’s time to create the Quote Line Item Flow!  First, go to Setup, Flows, create a New Flow.  Click on Resources, then double click SObject Variable.  Enter the Unique Name as sovQuote, Input/Output Type as Input and Output, and Object Type as Quote.  This SOject Variable allows you to pass the information from the Quote Entry Flow (you’ll set it up later) as well as update Quote fields as needed.

Continue reading

Add a New Quote Button – Learning Flow 1.E

Creating Flows are great, but if your Users can’t get to them, they don’t help too much…  It’s time to create a button to allow your Users to launch the Flow!

Start by capturing the Flow details.  In the Learning Flow series, you should have created a Flow with a Unique Name of Quote_Entry and the URL should be /flow/Quote_Entry.  You can get to the Flow details by searching Flows in the Setup search bar and clicking on the Flow you are looking for the details about.

Quote Entry Flow Detail Page

Now, there are a few ways to be able to create a button.  One way, using the Flow URL, can be found in the post, Update a Record Through a Button and Salesforce Flow.  The other way is through a Visualforce page.  I know, you’re expecting to learn about Flows here.  There is a lot of power by being able to use a Visualforce page to start a Flow instead of using the URL.  You’ll start with a basic Visualforce page in this post and in future posts, you’ll learn how to enhance the page to continue to improve your business processes and customize it for your business.

Continue reading

ERROR!!! Learn How to Work With Flow Faults – Learning Flow 1.D

Perhaps you have written a Flow and have seen this cryptic message.

Flow Unhandled Fault

NO!!!  What happened!?  Does your User know something went wrong?  Where did this come from?  This post, part 1.D of the Learning Flow series, will help you learn how to get better error message handling for both your Users and your Admins.

From my experience with Flows, a lot of Flows are based around the User, such as the Quote to Contract system you’re building as part of Learning Flow.  This means that Users want a resolution quickly, they are doing something and would like to complete that task immediately.  This means that quick notifications are very important, ones that will just work and won’t possibly have different issues themselves.  It’s time to get started. Continue reading

Replicate a Picklist in a Flow

There was a post in the Official: Salesforce Workflow Automation:

One of the field that user inputs on the screen is picklist in Salesforce. What is the best element to use for that. Do I need to create all picklist values as choices or is there any other way? Appreciate your help.

The short answer is, every picklist must be created in each Flow by a Dropdown List and Choices.  There is a long answer (very long!), and it’s Custom Settings!  Custom Settings were reviewed in Learning Flow 1.B. Find Related Records and Have Users Select Them in a Screen – Select a Contact and Price Book.  The Custom Settings reviewed in that post were Hierarchy, the Custom Settings in this post will be List.

Start by going to Setup and search Custom Settings in the Setup Search Bar.  Click on Custom Settings.  For the Label, type Picklist Fields, and for the Object Name, type Picklist_Fields.  Select List for the Setting Type, Visibility can be Public.  For description, type, picklist fields for different objects based on Record Type. Continue reading

Require Fields on Other Objects to be Filled Out in Order to Create a Record (Quote) – Learning Flow 1.C

No one likes dirty data, there are lots of tools out there to help dedupe leads, accounts, etc.  But what about if a field isn’t filled out.  Well, there are required fields, and validation rules, but what if that doesn’t work when creating a record since a User doesn’t know that information until later, but you would like to have that information required before creating a related record?  Enter Flows to the rescue!  That’s right, you read it correctly, require fields on other Objects in order to create a new related Object, all with point and click!  For this lesson, part 1.C of the Learning Flow series, you’ve been given a request from Management, before anyone can Quote a customer, it is required that a Billing Address is filled in on the Account and that there is a phone number listed so that Finance can reach the person/company and send an invoice.  For the Billing Address, the requirement is that every Billing Address has a street, city, country, zip, and if the country is US, USA, United States, or United States of America, there should be a State as well.  (State and Country pick lists have not been turned on in this example, but if you have them turned on in your Org, you can do this with them as well!)  It’s time to get started! Continue reading

Create an Input Screen for Users, Assign Variables, and Create a Quote – Learning Flow 1.A

This is the first post for the Learning Flow series to learn how to write and use Salesforce Visual Workflow (Flows) and the first post for Part 1, Main Quote Information, where you will learn how to use the Fast Create element, Screen element, and Assignment element in Flows.  You will also learn about sObjects and Flow Validation (similar to Validation Rules, but with one BIG difference).  You’ll create an input Screen for Users to enter information about the quote, Assign Variables to the quote from the inputs of the User, and create the quote.

Since this is the first part of Part 1 of the Learning Flow guide, you may need to set up quotes.  If you have a new developer instance or are testing in your sandbox (always test before sending to production!) and you haven’t turned quotes on, go to the Setup menu, click on Quote, and click Settings.  Enable Quotes and append Quote Related Lists to the Opportunity Page Layouts that will need to see Quotes.

OK, now that Quotes are set up, start by creating a new Flow.  After you open your Flow, drag the Screen element from the Palette into the canvas on the right.  Name the Screen, “Quote Entry”, and let Salesforce automatically create the Unique Name by pressing tab.  Since you will have the Flow continue on to another element after this screen (Assignment element), you want to change the Navigation Options from, “Show Finish and Previous buttons” to “Don’t show Finish button”.  For now, also uncheck the “Show Pause button”.

Quote Entry Initial Flow Screen

You want to check with your Users and Management to find out what the requirements are for gathering data and creating quotes.  For this lesson, you want to have the User enter in a Description, pick an Expiration Date for the Quote, Name the Quote and finally set the Status to Draft.  To start, click the Add a Field tab at the top of the Screen element area next to General Info.   Continue reading

Update a Record Through a Button and Salesforce Flow

Welcome to my first post!  This post will be a great start to learning Salesforce Visual Workflow, also known as Flows, where we will be able to create a button that when pressed, will update the Salesforce record.  This question was asked in the Orange County User Group. #ForTheCommunity


 

Hey,

Does anybody know the exact parameter in regards to saving a record automatically using a custom button? I’m trying to execute it by using Save=x & Save=1 but it just hasn’t done the magic yet. Please assist. Appreciate it.

Thanks in advance,


 

There was a way using URL hacks that you were able to create a link, have it update the record, and save.  For some, that is not available anymore…  But don’t worry, Flows to the rescue! Continue reading