Skip to main content
Hello everyone,

I've a situation where a record has a set of values in a text field received from an integration and this values need to be displayed as a Picklist in a Flow Screen. As this values change for each record I can't make a picklist field.

In the event of being able to split this value into a string of values, I can't seem to be able to create e picklist value set from this values, it will always ask me to choose an existing picklist field for an Object.

Is it possible to create a Picklist Choice Set for the Flow where I set the values it should have?

I don't seem to find any other way to represent that field as a Picklist on a Flow.
3 answers
  1. Apr 2, 2020, 12:27 PM
    Hello ANUTEJ,

    Thank you very much for the answer. I was just doing something similar but with a LIghtning Web Component as I need to use it in a Flow.

    Here is what I did.

    1º Create a new LWC

    For the XML File:

    I create two properties that will be available at the Flow. The first one will allow the component to receive the String with the possible values. The Second one will be where the chosen option will be stored when chosing a value at the Picklist.

    <?xml version="1.0" encoding="UTF-8"?>

    <LightningComponentBundle xmlns="urn:metadata.tooling.soap.sforce.com" fqn="checklistPicklist">

    <apiVersion>48.0</apiVersion>

    <isExposed>true</isExposed>

    <targets>

    <target>lightning__FlowScreen</target>

    </targets>

    <targetConfigs>

    <targetConfig targets="lightning__FlowScreen">

    <property name="valueString" type="String" label="Values" description="The String with the available values for the Picklist"></property>

    <property name="valueChosen" type="String" label="Chosen Value" description="The String with the value selected at the picklist"></property>

    </targetConfig>

    </targetConfigs>

    </LightningComponentBundle>

    For the JS File:

    With connectedCallback() the component is able to load the received value, split the values with the ';' char and insert each obtained value in the array. The HTML File has an onOnchange event at the picklist that will call assignValue(event) to obtain the chosen value and place it at the output variable.

    import { LightningElement, api } from 'lwc';

    export default class ChecklistPicklist extends LightningElement

    {

    @api valueString; // Arrives from the Flow

    @api valueChosen; // Goes to the Flow

    picklistOptionValues = []; // Contains the options for the Picklist

    connectedCallback()

    {

    var arrayValues = this.valueString.split(';');

    for(var i = 0; i < arrayValues.length; i++)

    {

    this.picklistOptionValues.push(arrayValues[i]);

    }

    }

    assignValue(event)

    {

    this.valueChosen = event.target.value;

    }

    }

    For the HTML File:

    I just put the picklist, taking the values from the array that contains the splitted String value from de JS File.

    <template>

    <select onchange={assignValue} class="slds-select">

    <template for:each={picklistOptionValues} for:item="next">

    <option class="uiINputSelectOption" key={next} value={next}>{next}</option>

    </template>

    </select>

    </template>

    Once the LWC is created, at the Flow I only need to add the component to a Screen piece and tell the variables that will be used:

    Hello ANUTEJ,Thank you very much for the answer. I was just doing something similar but with a LIghtning Web Component as I need to use it in a Flow.Here is what I did.

    Hope it helps until we can make this without code.

     
0/9000