0

I am trying to use multi select picklist in a lightning flow. Picklist values are being populated by a record choice set. I want to get the id of all selected picklist values. I came to know the limitation of multi select choice field which says flow variable will contain only last selected value. I need all selected records to process. Is there any workaround for this?

  • If that's the limitation, I would say the workaround is to create a custom Multi-Select Picklist lightning component (using the lightning design system) and add the component to a screen component in the flow. Pass input variables from flow to the component, implement controller logic to process all the selected values and pass the output values from the lightning component to the flow variables. I have done something similar for showing dynamic picklist choices in flows. Try making the component generic so that it can be re-used for other flows as well. Hope it makes sense. – Prudhvi Konda Oct 15 '19 at 12:06
  • @PrudhviKonda I can not use Custom lightning component because I will use this flow in FSL mobile app which does not support lightning components. – Aakriti.G Oct 15 '19 at 13:30
  • Hey, I tried multi-picklist component on Screen in Visual flow and I'm getting all the selected values as a ';' separated String. For instance, if I selected option A and option B and assigned the selection to a text variable. I see the value of the variable as A;B. – Prudhvi Konda Oct 15 '19 at 19:50
  • Ah! I think I miss read your question. So, you are using a Record choice set instead of a Picklist choice set. May I know the reason for that. If that's the case, you might use the Picklist choice set, and send the selected values to APEX component and implement APEX logic that fetches the Ids of the selected picklist values. – Prudhvi Konda Oct 15 '19 at 19:54
  • I am using record choice set because I need to display name field of all records in multi select picklist as an input. My issue is I need to get id of all selected records. Is it possible with multi select picklist ? – Aakriti.G Oct 16 '19 at 5:08
2

Sounds like the documentation needs to be written more clearly. When you set up a record choice set, you choose the fields to use as the labels and values of each generated choice. And then you can optionally choose to store additional fields from the generated choice in variables.

It's the second part that only respects the last selected choice. You can get the full list of selections by referencing the checkbox group or multi-select picklist component.

For example, if I selected three accounts, when I reference the checkbox group: - in a Display Text component, it resolves to "Edge Communications; Burlington Textiles Corp of America; Salesforce" (which respects the labels for my record choice set). - in a logic context (like Decision or Assignment), it resolves to a semicolon-delimited list of the IDs (which respects the values for my record choice set).

If I chose to additionally store the AccountSource field value in a flow variable, that variable would resolve to only the AccountSource value for the "Salesforce" account. That's because it's a Text variable and can only store one value at a time.

| improve this answer | |
0

Those who are having the same issue, please refer to this blog:-

Retrieve all selected records from a multi-select picklist in lightning flow

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.