function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

set current value of picklist in flow

I am using a flow to allow a user to edit a record.
I can display the current value of all the fields in the record except for picklists - is there any way to do this?

Also all my picklists in the flow are mandatory - do they have to be?

Best Answer chosen by Filikin
Jen BennettJen Bennett
It's been awhile since I set this up, but I believe you need to assign the field value to a variable, then create a choice and assign that variable to the choices stored value, then add that choice as the default value for the picklist.

All Answers

Hi , 

Here is another post that looks to be a similar question.  While it's not possible to include the values of a picklist dynamically in a flow field, there is an APEX solution offered there that may help you.

Hi Ashish, that only tells me how to populate the picklist - I need to set the current value. I am allowing the user to rerun the wizard on a record he has created earlier, so I need to display the values he picked the first time round. This works fine for text, number and checkbox fields, but I can't find a way to do it with picklists. Eamon Eamon Kelly ENCLUDE - Technology Donations and Solutions for Irish Charities Drumcondra Business Centre 120 Drumcondra Road Upper Dublin 9 Main Phone: (01) 6535099 Support Phone: (01) 4853435 Mobile: 085 7130794 Web: ENCLUDEit - technology donation website
Jen BennettJen Bennett
It's been awhile since I set this up, but I believe you need to assign the field value to a variable, then create a choice and assign that variable to the choices stored value, then add that choice as the default value for the picklist.
This was selected as the best answer
Perfect, thanks JJ, no way would I have figured that out.
Matt Sutton 7Matt Sutton 7

I had a similar issue with single choice picklists and used this option but I am really struggling with MultiPicklist choices and not wanting to overright existing choices I want them prepopultated with the existing choices in the multichoice fields.

Any thoughts?


Jen BennettJen Bennett
I believe the same method should work, but the display is ugly on it.
No, I tired it for a multiselect but cannot get the format right.
Salesforce returns the values in a multlselect separated by semicolons (one; two) feeding them into the flow multiselect as the default value just displays one; two - not on separate lines.
I tried one<br>two and one/ntwo without success.

Matt - did you get any further with this?
Matt Sutton 7Matt Sutton 7
not yet it is still on my to do list and am waiting for a flash of inspiration but I'm not gettting very far unfortunately.
thanks Matt, I ended up putting the current values above the multiselect picklist field and leaving the default blank. Then telling the user to only put in new selections if there is a change. Then only write the picklist if it is not empty. Best I can come up with until Salesforce allows more than one default value in a multiselect picklist Eamon Sent from my ASUS Pad
@Filikin, I just ran into this issue.  I'd like to display the default value of what is in the database on the user screen of a pick list.  So this is the only way??  
For a multiselect picklist it is the only way I could find. And there doesn’t seem to be any improvement with the Winter ’15 release.
Andy Kallio 7Andy Kallio 7
There is one detail that I think needs to be added to @jen's answer, which is awesome btw...there are so many posts out there on the dev board and an Idea all indicating that this can't be done. Anyway, I found that you have to use the rich text editor on the choice label to bring in the variable. For example, I had a simple Yes/No picklist custom field called 'Exclusion Required'. I followed Jen's instructions (see best answer) and made the choice label as 'Exclusion Required'...and I was confused upon testing why my default value was 'Exclusion Required' rather than the 'yes' or 'no' that was being held in the variable. This prompted me to use the rich text editor in the choice label and reference the variable...problem solved. 
Daniel Camp 15Daniel Camp 15
There is one problem... If the current variable value is empty (null), the default choice (variable) shows the Unique Name instead of being blank. Why would the Unique Name show up? If anything I could see it showing the variable name, but I need it to be blank (null) if there isn't any current value. I wouldn't mind if it said "- Select One -" and stored a blank value if nothing was selected, but seeing the unique name as the default choice doesn't work... Any solutions out there?
Anne-Sophie ChénéAnne-Sophie Chéné
I am having the same issue as @DanielCamp15, has anyone found a (non programming) solution?

Stephen Jenkins 22Stephen Jenkins 22
I actually have a workaround solution for a few of the issues that we have seen:
  • Required picklist
  • Unique Name in label
Here is what I have done:
  1. Create a constant to hold $GlobalConstant.EmptyStringUser-added image
  2. Assign the record current values to a set of variables in an Assignment element:User-added image
  3. Create a formula for the default values using BLANKVALUE() and the "default" value:User-added image
  4. Create a new Choice using the formula from Step 3 as both the Label and the Stored Value:User-added image
  5. Set the Default Value to the Choice created in step 4:
User-added image

These steps allow you to set an optional default if the record does not already have a value for the field.

An added bonus -- If you substitute {!EmptyString} or null for the "default" string in step 2, the picklist acts like it is optional!!!
Stephen Jenkins 22Stephen Jenkins 22
The bonus should read:
An added bonus -- If you substitute {!EmptyString} or null for the "default" string in step 3, the picklist acts like it is optional!!!
Anne-Sophie ChénéAnne-Sophie Chéné
Hi Stephen,

Can you explain how you use the constant {!EmptyString!} in your flow? because in your example you create it but I don't see in the screenshots where you use it.

I have tried to set a formula in my flow with BLANKVALUE({!mydefaultvaluevar}, {!EmptyString}) but it doesn't work and still displays the unique name of the default choice in the screen input picklist.

But if in the formula I set: BLANKVALUE({!mydefaultvaluevar}, 'None') then it displays 'None' in the screen input picklist as the default choice if the defaultvalue is empty. But the flow fails to proceed because 'None' is not a valid item of the picklist field.

Stephen Jenkins 22Stephen Jenkins 22
Sorry for the delay in my reply...

Here is a walk-through using the EmptyString Constant:
  • The formula using BLANKVALUE:

User-added image
  • The Choice definition using the above formula:
User-added image
  • The Screen Field that uses the above Choice:
User-added image
  • This Interview populates a Contact record. Shown are two of the fields that are affected by the EmptyString option, including the Children? field. I add an image here of the fields as they are seen on the Contact to show that the fields are not required, nor are they populated.
User-added image
  • Here is the Interview in action. Note that the fields show to be required (* next to the labels):
User-added image

In this example, when I click Next the values are stored as basically nothing.  I will add a few notes in my next response since I have reached the limit of image postings for this response....

Stephen Jenkins 22Stephen Jenkins 22
Continuing the previous response:
  • Here you can see the picklist responses and the EmptyString response:
User-added image
  • Compare the above to the field picklist from the Contact:
User-added image

Note: the default has to be a valid selection. In this example, since --None-- is a valid selection, that corresponds to null or EmptyString in the Flow world. In essence you ARE passing a value to the field, thus satisfying the Flow Picklist required field requirement, but since null and EmptyString are valid entries for non-required picklist fields, you trick the system.

Are the picklists you are trying to manipulate in Flow required? If you are adding 'None' as default, is 'None' a valid option for the picklist?

Note: 'None' is NOT equivalent to --None--.  In fact, '--None--' is not equivalent to --None--. Use null or the EmptyString Constant.

Stephen Jenkins 22Stephen Jenkins 22
One last item, now that I re-read your question:

Be sure to add the BLANKVALUE formula to both the Label and the Stored Value fields when defining the Choice.
Anne-Sophie ChénéAnne-Sophie Chéné
Thanks a lot Stephen, it's clearer now :) and it works great!
Rudy Rivas 7Rudy Rivas 7
Stephen can you confirm that when using the lightning experience on visual flows the defaultChoice formula doesn't apply the EmptyString. Instead the flow applies the uniqueName of the defaultChoice as a failsafe.
Josh Hines 4Josh Hines 4
Lightning no longer allows this method to work when calling the flow in a record.  It places the Unique Name in the as the name instead of leaving this as blank.