Default Variables on Choices in Visual Flow

One of the pieces that can be a bit difficult in Visual Flow to work with is having the Default value in a dropdown.  There could be a number of different reasons you’d like to have a dropdown or other type of Choice field to reference existing values.  However, it’s not the most straightforward inside of Visual Flow.  Also, the User Experience isn’t perfect, but it is very functional.  This post is going to be more conceptual than walking through all of the parts of creating and connecting a Visual Flow.  With that in mind, I am making the assumption that we’ve already got our Record Lookup, Picklist Field Variable assigned, and the other basics setup.

First let’s drag on our Dropdown Field into our Screen Element.

DragDropdown

Now, let’s create our Choice that will be our “Default” value.

SelectNewChoice

As we create the Choice, notice the “T” on our Label so that we can use a Rich Text Editor on the Label.  Not something you typically think of with the Label of a Choice, but it’s there for you!

Label

When we’re in the Rich Text Editor for our Choice’s Label, we just need to drop in the Variable we used in our Lookup that has the Default value.  Note… you can get as creative as you want with the label here.

IndustryLabel

It might also be safe to put in a default value for the variable with something like “– Please Select –” in the scenario that the field is blank on the record.  Cause, if the Industry variable in the above example is empty, the API name of the Choice will be used instead.

Now, we need to set the Stored Value of this Choice to be the Variable as well.  This means, that if they don’t modify the selection in the Dropdown that the current value will be what is updated on the record … so don’t miss this and make the value get cleared out because the Stored Value is null.

StoredValue

Now, setup the other Choice value(s) that you want to use.  In this scenario, I’m just going to use the default Picklist field of Industry.

Choices

Now, when used in action, it looks like this:

DefaultValue1.jpg

DefaultValue2

And, just like that we’ve defaulted a Choice field in Visual Flow!  Simple to do, but easy to overlook.  This little trick came from the Salesforce Discord channel: https://discord.gg/D8YGZkN, so give that a look if you use Discord.

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s