Posts

Showing posts from April, 2022

Open the Model Popup in LWC

Image
 Create the LWC //HTML FILE CODE <template>     <!-- lightning button for open modal window -->     <lightning-button variant="brand"        label="Open the Model/Popup?"        title="Open the Model/Popup?"        onclick={openModal}        class="slds-m-left_x-small">     </lightning-button>     <!--Use template if:true to display/hide popup based on isModalOpen value-->      <template if:true={isModalOpen}>         <!-- Modal/Popup Box LWC starts here -->         <section role="dialog" tabindex="-1" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1" class="slds-modal slds-fade-in-open">             <div class="slds-modal__container">                 <!-- Modal/Popup Box LWC header here -->                 <header class="slds-modal__header">                    

Fetch Picklist value in LWC using Schema class

Image
 Create the Apex Class: public with sharing class lwcPicklistController {          //fetch picklist values from  SOBJECT     @AuraEnabled(cacheable=true)     public static List < customValueWrapper > pickListValueDynamically(sObject customObjInfo, string selectPicklistApi) {        Schema.DescribeSObjectResult objDescribe = customObjInfo.getSObjectType().getDescribe();             map < String, Schema.SObjectField > customFieldMap = objDescribe.fields.getMap();              list < Schema.PicklistEntry > custPickValues = customFieldMap.get(selectPicklistApi).getDescribe().getPickListValues();        list < customValueWrapper > customObjWrapper = new list < customValueWrapper > ();        for (Schema.PicklistEntry myCustPick: custPickValues) {          customValueWrapper selectOptionValueWrapper = new customValueWrapper();             selectOptionValueWrapper.custFldlabel = myCustPick.getLabel();             selectOptionValueWrapper.custFldvalue = myCustPick