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 LWCFor 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.
For the HTML File: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;
}
}
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:
Hope it helps until we can make this without code.
3 answers