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
shalini sharma 24shalini sharma 24 

How to fetch List custom setting record from Lightning component

I want to create a picklist in lightning (<lightning:select>) and the value for the options should be fetched from List custom Setting. How can we do this?


Hi Shalini,

Fetch custom setting values in Apex controller and pass on to Lightning Component using JS Controller. 



shalini sharma 24shalini sharma 24
Hi Gaurav, 

<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" controller="cstmSettindData">
     <aura:handler name="init" value="{!this}" action="{!c.myAction}" />
     <aura:attribute name="optVal" type="List"/>
     <lightning:select name="select" label="Select a value">
        <option value="">-- None --</option>
        <aura:iteration items="{!v.optVal}" var="op">
        <option value="{!op.stage__c}" text="{!op.stage__c}"></option>
    myAction : function(component, event, helper) {
           //get state when country populated- start
                var optionValue = component.get("c.getListSettings");
                optionValue.setCallback(this, function(a) {
                   // end
public class cstmSettindData {
    public static  List<DropDown__c> getListSettings(){
        List<DropDown__c> dList = new List<DropDown__c>();
      dList = DropDown__c.getall().values();
      return dList;

Still I cannot see the options in the picklist. Attached is the screenshot.User-added image

Hi Shalini 

Any idea how was this issue fixed,i am facing the same
Erik Swiderski 24Erik Swiderski 24
I'm experiencing the same issue- If I manually specify the options for the list, like in this example:
loadOptions: function (component, event, helper) { 
var options = [ 
{label: 'indigo', value: 'indigo'}, 
{label: 'violet', value: 'violet'}, 
{label: 'scarlet', value: 'scarlet'}, 
{label: 'turquiose', value: 'turquiose'}, 
{label: 'sapphire', value: 'sapphire'}, 
{label: 'burgundy', value: 'burgundy'}, 

component.set("v.statusOptions", options); 
It works fine. However, if I use my helper function to get the data for the list from an apex list, I get the same result as shalini sharma 24. Has anybody found a solution?