How to Retrieve Picklist values in Lightning Web Component using JavaScript

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

  1. getPicklistValues Gives all the picklist values for the defined field. know More Here
  2. getPicklistValuesByRecordType Gives all the picklist values information related to a Recordtype for a Object. Know More here
  3. getObjectInfo gives you the complete information about the object. Know more here

Here is the video for the same

Amit Singh
Amit Singh

Amit Singh aka @sfdcpanther/pantherschools, a Salesforce Technical Architect, Consultant with over 8+ years of experience in Salesforce technology. 21x Certified. Blogger, Speaker, and Instructor. DevSecOps Champion

Articles: 299

Newsletter Updates

Enter your email address below and subscribe to our newsletter

4 Comments

  1. 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

Leave a Reply

Your email address will not be published. Required fields are marked *

Discover more from Panther Schools

Subscribe now to keep reading and get access to the full archive.

Continue reading