Posts

Showing posts from December, 2018

How to update the records with a button in salesforce lightning

Image
Apex class ========== public class AccountController {     @AuraEnabled     public static Account getAccountData(String AccountId){         Account acc= [select Id,Name,Site from Account where Id=:AccountId];         return acc;     }     @AuraEnabled     public static Account updateSite(Account acc){         acc.site='Approved by brahmanaidu as per the comments'; try{ update acc; } catch(Exception e){ throw new auraHandledException('unable to update the record due to'+e.getMessage()); }         return acc;     }  } component ========= <aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global"                     ...