Posts

Showing posts from October, 2019

How to edit the records in Lightning component

Image
Apex class ========== public class ContactCTRL4 {    @AuraEnabled    public static List<Contact> displayConRecords()    {        return [select LastName,Email from Contact LIMIT 10];    }     @AuraEnabled     public static list<Contact> updateConRecords(List<Contact> condata)     {         try         {             update condata;         }         catch(Exception e)         {             System.debug('unable to update the record due to '+e.getMessage());         }         return condata;     } } compoment ========= <aura:component  controller="ContactCTRL4">     <aura:attribute name="conlist" type="list"/>     <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>     <aura:attribute name="isEdit" type="boolean"/>     <aura:if isTrue="{!!v.isEdit}">         <lightning:button label="Ed

How to display the contact records based on Account with radio button in salesforce lightning

Image
Apex class ========== public class AccountController {     @AuraEnabled     public static List<Account> displayAccRecords()     {         return [select Id,Name from Account LIMIT 5];     }     @AuraEnabled     public static List<Contact> displayConRecords(String accId)     {         List<Contact> returnconlist=new List<Contact>();         for(Contact con:[select Id,AccountId,FirstName, LastName from Contact where AccountId=:accId])         {             if(con!=null)             {                 returnconlist.add(con);             }         }         return returnconlist;     } } Accountcomponent.cmp ==================== <aura:component implements="force:appHostable, forceCommunity: availableForAllPageTypes" access="global" controller="AccountController" >     <aura:attribute name="accData" type="list"/>     <aura:attribute name="conData" type="list