function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Leticia Monteiro Freitas 4Leticia Monteiro Freitas 4 

How populate a Lightning Combox using a pickList field values?]

Hello,

I'm trying populate a lightning combobox with a value from a specific PickList Fiel. Could anyone help me?
 
Alain CabonAlain Cabon
Hello,

Did you just try   <lightning:inputField fieldName="LeadSource" />
  • Picklist and multi-select picklist: Displays a picklist or multi-select picklist. Dependent picklists must be defined in your org before you can use them with lightning:inputField. Both controlling and dependent fields must be included in your component. See the example below.
https://developer.salesforce.com/docs/component-library/bundle/lightning:inputField/documentation

But a strong constraint with the needed <lightning:recordEditForm >
 
Leticia Monteiro Freitas 4Leticia Monteiro Freitas 4
Alain, 
Is there anyway to pass the api name from field to my lightning combobox?
 
Alain CabonAlain Cabon
In fact, Salesforce promotes <lightning:recordEditForm > as far as possible.

Many common lex components for picklist use the metadata but there is a strong bug because the recordtype is not a parameter.for the function getPicklistValues() of DescribeFieldResult.

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_fields_describe.htm

<lightning:inputField> into a <lightning:recordEditForm> is more accurate.

Salesforce tries to hide the big technical issue of the missing "Recordtype" parameter.for the function getPicklistValues() of DescribeFieldResult by promoting <lightning:inputField>

As long as you don't need a list of values of picklists with a recordtype, you can use the metadata.
https://naveendhanaraj.wordpress.com/2018/06/19/lightning-picklist-component/

Otherwise, you need a hardcoded lists of values for your combobox (it is one the most-dread limitation of Salesforce with the lookup component).