Hi Folks,
In this Post, we will learn how we can get the picklist field values in our Lightning Web Component using JavaScript Controller. We do not need to write a single line of apex code.
We will utilize the inbuilt uiObjectInfoApi library provided by salesforce.
It contains all the required methods to get the information about picklist field values.
This Library has the following 3 methods which we are going to learn
getPicklistValues Gives all the picklist values for the defined field. know More Here
getPicklistValuesByRecordType Gives all the picklist values information related to a Recordtype for a Object. Know More here
getObjectInfo gives you the complete information about the object. Know more here
Hello Amit,
I am trying to retrieve pick list values of a field in lightning component. Everything works fine, but the problem is I am able to see the picklist values in alphabetical or ascending order. I need to show them in the order as I defined when created that custom field. Any workaround for this. Any help will be greatly appreciated. Thanks in advance
Hi, I did not give it a try I will check and get back to you 🙂
Hello Amit
If we have picklist field in custom metadata for this Can we get the picklist value ?
Hi Pankaj,
You have to make the Apex call and then get the details from them.