Default and NULL Pick-list Values in Flow Screen Elements
When creating flow screens its often preferred to show a value from the record for a field in your screen if the record in question could have a value in that field already.
Out the box salesforce will use the fields pick-list values and show the first in that value list as the value in the screen element. Not ideal!
It's also not currently blindingly obvious how you would set this to the value held on the record (or another value if the value on the record is not set yet).
Here's how to handle all these scenarios' and thankfully it's not too difficult 👍
Its preferable now in most cases where you launch a flow from a button to use lightning actions. The buttons are very easy to setup and unlike the old classic method you do not need to have a visual force page in the middle to send variables across to the flow; however.
The button will only send the record id from the record it is launched from. To access this in your flow simply create a variable as per the below screenshot.
From here we can then get all the record and related record fields we need using a get element;
Now onto how to set our screen based pick-list to the same value the corresponding field on the record already contains. In this example I want to grab a stage value from a pick-list and show this in the screen flow element.
Create a formula based variable with the value being that of the Get_ for the record in question.
Now create a choice where the label and the value that of the formula based variable created above.
Now create a choice set that represents all the values in that pick-list so the user can select another value than that already on the record if required.
Lastly in your screen flow element create a pick-list component and add its choices, both the fixed set of choices and the formula driven choice - and set the formula driven choice as the default value.
Done! - the flow will now display the value in this screen from the record when the screen is loaded from eg; the button that launches the flow.
And now quickly - if you want to display a pick-list and you don't want salesforce to display the first value in the list by default.
Create a new pick-list choice which represents an unselected value.
Add this choice to any pick-list in your flow where you wish the user to make a selection before progressing (without this the user can pass over the pick-list and the value taken will be that which was already defaulted by the flows default behaviour which is not really desirable).
Now to check that the user didn't also just pass over this default value.
In the error screen they can only select 'previous' which the default behaviour is kind enough to always drive us back to the appropriate prior screen even if there were multiple possible screen options. This element therefore does not need to forward on at all and can be a 'dead end' in the flow.
The user then can go back, enter a value into that drop-down as required and proceed, then avoiding the above error.
So that completes it. I hope you found this useful!?!