Requiring Fields at a Certain Opportunity Stage

Throughout the sales cycle, there may be certain fields that you would like to required by stage.  There are different ways to do this, for example changing record types by stage and having required fields or using validation rules to require fields if the stage is equal to a certain value.  Each way to do this has its own benefits and also its own negatives.  I had this need come up with a specific caveat, that it should be very easy for someone who is an admin be able to manage it with ease, as well as show users what fields would be required when the stage was selected.  My first thought was to use a Flow that would walk the users through the fields that would be required at that stage and at the end of the Flow, update the stage to the new value.  Although this sounded great, it would require someone to update a Flow to add new fields to the requirement.  Flows are great for requiring fields to be entered through required fields on a screen, but managing a change in a picklist value, with record types, as well as adding or removing required fields as the business dictates, makes a Flow a lot to manage.  Enter another level of Salesforce adminvelopment.  (Yes, I saw on the community someone posted, adminveloper, and adminvelopment is a byproduct of adminveloper.)
Continue reading

Send Quote Flow to Quote Line Item Flow – Learning Flow 4.A

This is part 4.A of the Learning Flow series, how to send Users to the Quote Line Item Flow from the Quote Entry Flow.  To start, open the Quote Entry Flow.

In the Palette, navigate to the FLOWS section.

Quote Entry Palette Flows Section

Click on the Quote Line Item Flow and drag it below the fcQuote Fast Create Element.  For the Name and Unique Name enter sfQLI for Sub-Flow Quote Line Item.  Since the Quote Line Item Flow is expecting the sovQuote sObject Variable, in the Target, click the drop down arrow, then click the arrow next to SOBJECT VARIABLES, then select sovQuote.  In the Source section, click the drop down arrow, then SOBJECT VARIABLES, then select sovQuote.

Quote Entry Flow To Quote Line Item Entry Sub Flow

Click 0n the Outputs section.  Click the trashcan to the right side, you won’t need to send any information back from the Quote Line Item Flow.

Quote Entry Flow Delete Line To Quote Line Item Entry

Click OK at the bottom.  Connect the fcQuote Fast Create Element to the sfQLI Quote Line Item Element.

Quote Entry Flow fcQuote To sfQLI

Save the Flow!

Quote Entry Flow v5

That’s it!  Congratulations!  You have sent your users from the Quote Entry Flow to the Quote Line Item Flow to create Quote Line Items!

Launch a Flow using Lightning Process Builder!

Some things just go together, like:
Peanut Butter and Jelly
Bread and Butter
Cinnamon and Sugar
Tom and Jerry
Thunder and Lightning

I’m sure you get the picture!  Now, I’m still warming up to the idea of calling Flows Thunder, but they go together with Lightning Process Builder just like Thunder and Lightning.  The same way that Lightning comes first and is followed by Thunder, Lightning Process Builder can run and kickoff a Flow as an output.  You get an update in a flash followed by a roar of business process!  Ok, enough with the symbolism!

This For The Community post has been brought to you by the world famous Salesforce Community, the Official: Salesforce Workflow Automation group!  Thanks @Jay Singh!

Jay came to me with a question:

Hey Rich,
Hope you are doing well! I know that you’re a Salesforce flownatic and I just happened to bump into something while creating a flow. I’m trying to get the Contact Roles from the Account module and try to get them to populate over to the Opportunity Contact Roles. So if a Contact Role gets created under the Account, it should appear automatically on the Opportunity’s contact roles. Do you think you can create a blog post for this particular flow. I will truly appreciate it.
Thanks in advance,
Jay Singh

As I told Jay on my initial response, kicking off workflow from the Account Contact Role doesn’t quite work with the Standard Salesforce Account Contact Roles.  A Custom Object can be used to kickoff workflow, so, upon his blessing to use a Custom Object, we’ll look at how to accomplish his question using Process Builder to launch the Flow.  He also said that:

it should update all Opportunities and should only include the Contacts that I am adding from the Contact Roles

Ok.  Custom Contact Role tied to the Account, when that is launched, add the new Contact Role as an Opportunity Contact role to every Opportunity on the Account, that’s our goal.  Let’s get started!

Continue reading

Create Approval Process in the Approval Process Flow – Learning Flow 3.B

With the Step Elements entered, it’s time to create the actual Flow.  Open the QLI Approval Process Flow.

Click on the Resources Tab in the left section and double click on SObject Variable.  Enter sovQLI as the Unique Name, the Input/Output Type as Input and Output, and the Object Type as QuoteLineItem.

Approval Process sovQLI

Click OK.  Click on Resources again and then double click on Formula.  For the Unique Name, enter fDiscount, Value Data Type as Number, Scale as 2, and the Formula should be, “{!sovQLI.UnitPrice}/{!sovQLI.List_Price__c}”.

Approval Process Discount Formula

Click OK.

You might be wondering, I see a {!sovQLI.ListPrice}.  Although this is true, since you are looking at the Quote Line Item before it is created, the {!sovQLI.ListPrice} hasn’t been entered yet.  It is also a field that is part of the Product.ListPrice, so it doesn’t translate very well with Flows.  Since you created the List_Price field earlier and assigned the List Price of the Price Book Entry, this does two things for you.  First (and most importantly), you can use the List_Price field in this Flow.  Second, it saves the history of the List Price, so if the List Price changes in the future, you’ll know what the List Price of the Quote Line Item was at the time of creation. Continue reading

Planning the Approval Process Visually – Learning Flow 3.A

Planning a Flow is a very important piece of creating Flows.  So far, you’ve been learning from what the posts tell you to do.  What about new Flows where you need to plan out a process?  Well, the Step Element will allow you to plan out your Flows!  You can’t activate a Flow with a Step element, but it will allow you to plan it out to make sure you are entering all the Flow steps needed to create a successful Flow!

Open the Quote Line Item Flow.  From the Palette, click on the Step Element in the Draft Tools section.  Drag it to the left of the aQRU Assignment Element.  Enter the Name and Unique Name as sAP for Step Approval Process.  Enter in the Description, This step will loop through the Quote Line Items to be able to see what level of Approval is Needed.

Quote Line Item sAP

Click OK.  Click on the Step Element in the Palette again and drag it above the sAP Step Element.  For the Name and Unique Name enter sAAP for Step Assign Approval Process.  For the Description enter, This will assign the proper approval on the Quote for Approval Processes. Continue reading

Create Quote Line Items, Update Quote – Learning Flow 2.C

Part 2.C of the Learning Flow series will allow you to create the Quote Line Items and Update the Quote.  To start, open the Quote Line Item Flow.

From the Palette, click 0n Fast Create and drag it to the right of the aQRU Assignment Element.  Enter the Name and Unique Name as fcQLI, for Fast Create Line Item, and set the Variable as socvQLI.

Quote Line Item Flow fcQLI

Click OK.  Connect the aQRU Assignment Element to the fcQLI Fast Create Element. 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