Posts

Showing posts from May, 2019

How to display the records based on selected picklist value in Lightning

Apex Class  ----------  public class FetchPicklistOptsController  {     @AuraEnabled     public static List < String > getselectOptions(sObject objObject, string fld) {         system.debug('objObject --->' + objObject);         system.debug('fld --->' + fld);         List < String > allOpts = new list < String > ();         // Get the object type of the SObject.         Schema.sObjectType objType = objObject.getSObjectType();             // Describe the SObject using its object type.         Schema.DescribeSObjectResult objDescribe = objType.getDescribe();             // Get a map of fields for the SObject         map < String, Schema.SObjectField > fieldMap = objDescribe.fields.getMap();             // Get the list of picklist values for this field.         list < Schema.PicklistEntry > values =             fieldMap.get(fld).getDescribe().getPickListValues();             // Add these values to the selectoption