I have a screen flow that is currently launched from a record page via an action. This action, once the flow completes, will create a new record of a custom object. There are plans in the near future to enhance this flow. Some of these enhancements would be to launch it from a different location: the highlights panel, a list view, or the utility bar in a console application. Therefore, I can't always assume that it will launch from a record page.
I would like to set a picklist value within the screen flow when the flow is launched. This value will be dependent on if they're currently viewing a custom object record (e.g. IF(ISBLANK(recordId), A, B). If it is blank, set picklist value to A. If recordId is not blank set the picklist value to B.
This picklist screen component is driven by a picklist value set and is based on a single-select picklist field on a custom object. This picklist is required, and therefore should always have one value or another.
Things I've tried:
- Decision step to check of recordId is blank at the start of the screen flow. Then an assignment step to set the value of the picklist to one value or the other. However, the picklist screen component does not appear in an assignment to set the value.
- A text formula field to determine what I want the value to be. IF(ISBLANK(recordId), "value_a", "value_b"). The formula will resolve to a text value. use this text value as part of an assignment to the picklist screen component. again not an option.
- We don't want to set a default value on the picklist field on the object. We shouldn't force one option over the other and hope we guessed correctly and/or make them change it if it's incorrect. Was hoping to make that decision for them and save 'em a click or two.
- Set up a text variable for each choice and another as the assignment variable. For example, variables: "value_a", "value_b", "picklistValue". Then after the proper choice is determined, set "picklistValue" equal to determined value (e.g. "value_b"). Then, at the end, assign "picklistValue" to Object.PicklistField__c when the record is created at the end of the flow. Was hoping for a UI update once the proper picklist value could be determined even before actually saving the field.
- If it were possible to set the value on the screen component via dot notation after a decision, this would be super simple {!AwesomePicklist.valueA} or {!AwesomePicklist.valueB}. Although it doesn't appear that you can get at the choices of the picklist this way.
- Configure a pre-determined value on the Action when it is launched. This one is very similar to #3 and we can't simply flip a coin and guess the default. We'd like it to be more dynamic.
I've been searching around for a solution and can't seem to find one. I'm stuck. There has to be a way. It's probably something simple that I'm overlooking or even perhaps overengineering. I can't be the first one that's wanted to do this.
Help me guru's you're my only hope.
@Lightning Flow Discussions
#flowYes, that's exactly what I am trying to do. If they're launching the flow from a record page then the picklist should have option A, otherwise option B. This picklist must have a value to create the underlying custom object record. Would be nice to also launch this flow via an action on a list view as well. so wanted to make the flow smart enough to select the proper picklist value for the user--save 'em a click depending on where it's launched.