Latest Real Time Interview Questions2021 For Experienced Developers 2021(Own Experience)||Experienced||Developers||2021||Top Interview Questions||Set 6

  Set 6:


Technical Round:

  • How to schedule batch class for every 15minutes.
  • What is encryption in integration.
  • Mixed DML error.
  • What is the limit of records retrieved in Start method of Batch class?
  • What is the maximum records can be processed in execute method per batch?
  • User is not able to see new button in campaign tab. what would be the reason
  • If I don’t want to use finish method in batch class, can I remove it from the class. If NO what is the reason.
  • What is the maximum master detail records can be created for object?

All The Best😊😊😊

Latest Real Time Interview Questions2021 For Experienced Developers 2021(Own Experience)||Experienced||Developers||2021||Top Interview Questions||Set 5

  Set 5:


Technical Round:

  • How do you think Aura/LWC client-side server reduces apex calls compared to classic VF page?
  • Big objects in salesforce
  • Async SOQL
  • What is the things we can do in VF page and not in Aura/LWC?
  • I want to update 40fields of single in a transaction using workflow rule. How to do it and how many workflow rules/Actions needs to be created.
  • Continuous class in Apex.
  • What is entitlement in service cloud.
  • Can we deploy apex trigger with 1% test coverage to PROD, If yes how to do the same?
  • How to delete apex class in production (By using destructive changes in ANT migration)
  • What are external objects and how we use it.
  • Whether I have worked on Single Sign On (SSO) and what is SSO.

All The Best😊😊😊

Latest Real Time Interview Questions2021 For Experienced Developers 2021(Own Experience)||Experienced||Developers||2021||Top Interview Questions||Set 4

 Set 4:


Technical Round:

  • Async SOQL queries
  • Web-to-case
  • Is web-to-lead present in salesforce
  • Batch class syntax and one example
  • From external system by using apex can we create records in salesforce.
  • Architecture of aura components.
  • How to access private methods in test class.
  • How to configure person account.
  • What is object API name for person account?
  • Which cloud you have worked mostly
  • View state

All The Best😊😊😊

Latest Real Time Interview Questions2021 For Experienced Developers 2021(Own Experience)||Experienced||Developers||2021||Top Interview Questions||Set 3

 Note: This post contains salesforce interview questions which I encountered during my interviews recently (2021). 


Set 3:

Technical Round:

  • Assume there is Account which can have many opportunities and each opportunity will have many quotes. How to design map where key is AccountID and value is respective quotes.
  • There are three objects Policy, Transaction and Receipt and One Policy can have many truncations and each traction can have receipts. In UI we need to show Each policy and also respective truncations and Receipts.
  • Can we have more than one parent -child inner query in single SOQL query. (Like Account>Opportunity>Quotes)
  • When we have 1 Lakh records updating, Will trigger be able to process all the records.
  • SOQL query limit in test class.
  • Manager is not able to see his subordinate records. What are all the reasons might be there
  • Can we remove role hierarchy for standard objects?
  • Sales process, support process is on which objects and what are they.
  • Which design pattern you use for Apex.
  • SOQL limit in Apex and Async Apex.
  • Maximum size of List we can use per truncation.
  • DML limit for Sync and Async.
  • There are two LWC’s A &B which are present in two tabs. On click on A LWC user needs to navigate to B which is in other tab.
  • Recent update for @track in winter 21
  • How to test LWC
  • If there is a validation rule which fires if amount equals to 100 it will throw error message and there also workflow rule if amount greater than 1000, field will be updated to 100.Now if user enters 1100 will validation rule will fire.
  • When we write after delete trigger and If we throw error In after delete, will record get deleted?

All The Best😊😊😊

Latest Real Time Interview Questions For Experienced Developers 2021(Own Experience)||Experienced||Developers||2021||Top Interview Questions||Set 2

Note: This post contains salesforce interview questions which I encountered during my interviews recently (2021). 


Set 2:

Technical Round:

  • objects/OWD/Profiles/Permissions
  • How many ways we can share records In salesforce?
  • What is manual sharing
  • Workflow actions and evaluation rules
  • Process builder actions
  • Apex Best Practices
  • What type of integration is workflow outbound messages (SOAP)
  • Triggers Best Practices
  • Can we make callout from Trigger?
  • Can we make callout from queueable?
  • How to track failed records in batch class across all the chunks and send a mail to user with failed records.
  • What is difference between AURA/LWC.
  • Why we need LWC as salesforce already have AURA.
  • Decorators in LWC
  • How to navigate to Sobject record in LWC
  • How to call Apex method from Process Builder.

All The Best😊😊😊

Latest Real Time Interview Questions For Experienced Developers 2021(Own Experience)||Experienced||Developers||2021||Top Interview Questions||Set 1

Note: This post contains salesforce interview questions which I encountered during my interviews recently (2021). 

Set 1:

Technical Round:

Security Model for Salesforce (Like objects/OWD/Profiles/Permissions/Sharing).
Why we use seealldata=true in test class

Child to parent and parent to child queries.

Order of execution in salesforce.

Do you follow latest release from salesforce?

What is Wrapper class and where did you use it in your case.

Why we use custom settings and custom metadata and what is the difference between both of them.

Whether I have worked on Aura.

Difference between Workflow/Process Builder.

Events in salesforce.

Scenario: Assume there is account records and if any update happens to that record. we should not update that account with those new changes provided by user, instead we should create new record with the updates provided by user. How shall we achieve it?

What is roll up summary field.

Can we create roll up summary field for lookup relationship field and if not how to implement roll up summary field in custom way.

How To Reset Security Token In Salesforce



How to reset security token:

Before we know how to reset security token ,let us see what is it means.


Security Token In Salesforce :

Security token is alphanumeric key that is used along with password to access salesforce through API .The reason to use the token is to make the salesforce more secured in case of API connections.


Example :If you have client data resides on oracle server and it integrates with salesforce via informatica tool to exchange data between oracle server and salesforce .Salesforce contains separate integration user ,which is responsible for data exchange between client server and salesforce .

Now informatica should use integration user credentials to establish the connection with salesforce. During authentication with salesforce, Informatica uses integration username and password along with security token to establish the connection.


Please follow the below steps to reset the security token :

1.Click on your name and navigate to My Settings as shown in Picture 1:

Picture 1:












2.Navigate to Personal tab in the left side and click on Reset Security Token option as shown in the picture 2.

picture 2:




















3.Now Finally click on Reset Security Token button to reset your security token. 

Picture 3:






4.After following the above steps you will receive new security token to your email .

Picture 4:









Reset security token for the profiles which enabled with login IP ranges :

If the profile is enabled with login Ip ranges ,then reset your security token option does not appear in My Settings .In this case you might have to disable the IP ranges till token reset and again you can add back the ip ranges .


*********************************************************************************************

We hope you are cleared with the process.
If you still require further clarifications,Please let us know in the comments .
Please follow us for more salesforce concepts.Happy Learning☺☺☺




Apex Trigger Examples || Salesforce Apex Triggers

Basic Apex Trigger Examples:



1.DemoTtrigger1

DemoTtrigger1 Populates Description field with the user first name who creates or updates the record by using userInfo standard keyword . And also does not allow user to delete the record .

trigger DemoTtrigger1 on Author__c (before insert,before update,before delete) {
    If(trigger.isInsert){
        for(Author__c Author: Trigger.new){
            //Populates Description with the user first name who creates the record
            Author.Description__c = 'Author Created by '+ userInfo.getFirstName(); 
        }
    } else
        If(trigger.isUpdate){
            for(Author__c Author: Trigger.new){
          //Updates Description with the user first name who updates the record
                Author.Description__c = 'Author Last updated by '+ userInfo.getFirstName();   
            }
        }
    if(Trigger.isDelete&&Trigger.isbefore){ 
        for(Author__c Rec:trigger.old) 
        {
          //User gets the below error when user tried to delete the record
            Rec.adderror('You Cannot Delete the Author Record');
        }
    }
}


2.DemoTrigger2

Whenever new account record creates"Account_Rep__c"  updates with the account owner name.
  
trigger DemoTrigger2 on Account (before insert) {
    Set<Id>setAccOwner=new Set<Id>(); 
    for(Account Acc: trigger.new) 
    { 
        setAccOwner.add(Acc.OwnerId);     
    }
    map<id,user>userMap=new map<id,user>();
    for(user u:[select id,Name from user where id IN:setAccOwner]){
        userMap.put(u.id,u);
    }
    for(Account Acc: Trigger.new)
       
    { 
        User usr=UserMap.get(Acc.OwnerId); 
        system.debug('usr');
        Acc.Account_Rep__c=usr.Name; 
    }
}

Note :Most of the examples here made use of  Map/List .If you are not sure about the Map/List concepts ,Please make use of below post which clearly explains about collections in salesforce .
https://salessforcehacks.blogspot.com/2020/01/collections-in-salesforce-list-set-map.html

  3.DemoTrigger3

DemoTrigger3 prevents user to delete contact which is associated with the any account. When user tries to delete associated contact ,User will be presented with the error "Contact associated with account cannot be deleted"




trigger DemoTrigger3 on Contact (before delete) {
    //Contact with associated account cannot be deleted
   if(Trigger.isDelete&&Trigger.isbefore){
    for(contact con:Trigger.old){
        if(con.accountId!=null){
            con.addError('Contact associated with account cannot be deleted');
        } 
       
    }}

4.DemoTrigger4

 Creates opportunity record if the account doesn't contain at least one opportunity.

trigger DemoTrigger4 on Account(after insert, after update) {
    List<Opportunity> oppList = new List<Opportunity>();
   
    // Get the related opportunities for the accounts in this trigger
    Map<Id,Account> acctsWithOpps = new Map<Id,Account>(
        [SELECT Id,Name,(SELECT Id,Name FROM Opportunities) FROM Account WHERE Id IN :Trigger.New]);
    System.debug('acctsWithOpps  ::'+acctsWithOpps);
   
    // Add an opportunity for each account if it doesn't already have one.
    // Iterate through each account.
    for(Account a : Trigger.New) {
        System.debug('acctsWithOpps.get(a.Id).Opportunities.size()=' + acctsWithOpps.get(a.Id).Opportunities.size());
        // Check if the account already has a related opportunity.
        if (acctsWithOpps.get(a.Id).Opportunities.size() == 0) {
            // If it doesn't, add a default opportunity
            oppList.add(new Opportunity(Name=a.Name + ' Opportunity',
                                       StageName='Prospecting',
                                       CloseDate=System.today().addMonths(1),
                                       AccountId=a.Id));
        }         
    }
    if (oppList.size() > 0) {
        insert oppList;
    }
}

5.DemoTrigger5

 DemoTrigger5 send email notification after new student record created into the system.               Trigger makes use of handler class to send an email notification. Trigger collects newly created     student records and send them to the handler class to process further for the email   notification.

trigger DemoTrigger5 on student__c (After insert) {
   if(Trigger.isinsert&&Trigger.isafter){
       StudentEmailNotification.sendMail(Trigger.new); 
   }

}

class :

public class StudentEmailNotification {
    // Public method
    public static void sendMail(List<student__c> stuList) {
        // Create an email message object
        system.debug('stuList in sendmail method :'+stuList);
        for(student__c st :stuList){
            Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
            String address=st.Email__c;
            String[] toAddresses = new String[] {address};
            String ccAddresses=st.Class_Owner_Email__c ;
            system.debug('ccAddresses :'+ccAddresses);
            String[] setCcAddresses=new String[] {ccAddresses};
            mail.setToAddresses(toAddresses);
            mail.setCcAddresses(setCcAddresses);
            mail.setSubject('Student Registration Notification');
            mail.setPlainTextBody
                ('The Student' + st.Name + ' Registration is Completed with the below details :'+'\n\n' +
                 'Student Name : ' + st.Name + '\n\n'+
                 'Request Email : ' +st.Email__c + '\n\n' +
                 'Class: ' +st.Class__c+ '\n\n' +
                 'Please reach out to System Administrator if you require any further information');
            Messaging.SendEmailResult[] results = Messaging.sendEmail(
                new Messaging.SingleEmailMessage[] { mail });
        }
    }
}

6.DemoTrigger6 

 Updates "Associated_Contacts__c" with the number of contacts associated with the account .   Whenever new contact creates/removed from the account ,The respective count would be   increased/Decreased accordingly. 

trigger DemoTrigger6 on Contact (before delete,before insert,after insert,after delete,after update) {
    //Update count of the contact to the 'Associated Contacts' field in the account
    set<id> accid=new set<id>();
    list<contact> contactlist =new list<contact>();
    list<contact> listcon=new list<contact>();
    list<account> listAcc=new list<account>();
    list<account> acclist=new list<account>();
    map<id,integer> mapCount=new map<id,integer>();
    
    if(trigger.isinsert){
        
        for(contact con:trigger.new){
            
            accid.add(con.accountid);
            
        }
        
    }
    
    if(trigger.isdelete){
        
        for(contact con:trigger.old){
            
            accid.add(con.accountid);
            
        }
        
    }
    
    acclist=[select id,name,Overall_Contacts_Status__c from account where id in:accid];
    
    contactlist = [select id,Status__c,name,accountid from contact where accountid in:accid];
    
    for(account acc:acclist){
        
        listcon.clear();
        
        for(contact c:contactlist){
            
            if(c.accountid==acc.id){
                
                listcon.add(c);
            }
        }
        mapCount.put(acc.id,listcon.size());
    }
    if(acclist.size()>0){
        for(Account a:acclist){
            if(mapCount.get(a.id)==null)
                a.Associated_Contacts__c=0;
            else
                a.Associated_Contacts__c=mapCount.get(a.id);
            listAcc.add(a);
        }
    }
    if(listAcc.size()>0)
        update listAcc;    

}  
 //you can also reduce the code with account inner query like below

trigger DemoTrigger6 on Contact (before delete,before insert,after insert,after delete,after update) {
 set<id> accountIds=new set<id>();
    List<account> accList=new List<account>();
    map<id,integer> noOfContacts=new map<id,integer>();
    List<account> updateaccList=new List<account>();
    if(Trigger.isinsert||Trigger.isUpdate&&Trigger.isafter){
        for(contact con:Trigger.new){
            if(Trigger.isinsert){
                accountIds.add(con.accountId);
            }else if(Trigger.isUpdate&&trigger.oldmap.get(con.id).accountId!=null&&con.accountId==null){
                accountIds.add(trigger.oldmap.get(con.id).accountId);
            }
        }
    }
    if(Trigger.isDelete&&Trigger.isafter){
        for(contact con:Trigger.old){
            accountIds.add(con.accountId);
        }
        
    }
    system.debug('accountIDs:'+accountIds);
    accList=[select id,(select id,accountId from contacts) from account where id IN:accountIds];
    
    for(account acc:accList){
        if(acc.contacts.size()>0){
            acc.Associated_Contacts__c=acc.contacts.size();
        }else{
            acc.Associated_Contacts__c=0; 
        }
        updateaccList.add(acc);
    }
    system.debug('updateaccList:'+updateaccList);
    update updateaccList;
}


7.DemoTrigger7

DemoTrigger7 helps to avoid recursive trigger by using the handler.

trigger DemoTrigger7 on Account (after insert) {
     if(RecursionExampleHandler.isFirstTime){
          RecursionExampleHandler.isFirstTime=false;
    for(account a:Trigger.new){
        account acc=new account();
     acc.Name='Recursive Test';
        insert acc;
    }
     }
}

class :

public class RecursionExampleHandler {
public static Boolean isFirstTime=True;
}

You can also visit below post to know more about recursive trigger scenario
https://salessforcehacks.blogspot.com/2019/12/salesforce-recursive-triggers-fully.html 

8.Apex Managed Sharing :

Until now Most of us know the methods of sharing the records across organization by using sharing rules  and OWD ,This example helps us to share records in programmatic way(Apex Trigger/Apex Class) for the complex business requirements .


Scenario Based Example:

Prerequisite:

Objects Used in the discussion:

1.Project--Object contains all the business task details which require to be completed .

2.Project Member--Are the members who work on the project which has assigned to them.
   Project Member is junction object which is master-Detail with Project and Contact


3.Contact--Sales force Contact Object
   Assume all the contacts Owner is assigned with their own User ID .
Eg .We have user Kris who is also Owner for associated contact named Kris .

Use Case :

1.Whenever status of the project changed from 'New' to 'Assigned' The respective project record access should be shared with all the Project Members .

2.Once the Project Members completed their assigned task and Status of the Project changes to 'Completed' then Access should be Revoked/Removed from the Project Team Members .

Solution: 

We require to create Apex Trigger on Project object and create the share object records and delete the access after Project completed

The below Trigger collects all the project records for which status changed to 'Assigned' Or changed to 'Completed' and send them to Apex class to create and Revoke the access respectively  by using apex sharing .

Apex Trigger :

trigger ProjectShare on Project__c (after update) {

    List<Project__c > projectShareList=new List<Project__c >();

    List<Project__c > revokeShareList=new List<Project__c >();

    //Share the access

    if(Trigger.isafter&&Trigger.isUpdate){
   
        for(Project__c Pro:Trigger.new){
       
            if(Pro.Status__c=='Assigned'&&trigger.oldmap.get(Pro.id).Status__c!='Assigned'){
           
                projectShareList.add(Pro);
           
                system.debug('Share the access'+Pro.id);
           
            }
       
        }
     
        if(projectShareList!=null){
         
            ProjectShareclass.provideAccess(projectShareList);
           
        }
   


        //Revoke the access
   
        for(Project__c Pro:Trigger.new){
       
            if(Pro.Status__c!='Assigned'&&trigger.oldmap.get(Pro.id).Status__c=='Assigned'){
           
                system.debug('Revoke the access'+Pro.id);
           
                revokeShareList.add(std);
           
            }
       
        }
        if(revokeShareList!=null){
       
            ProjectShareclass.revokeAccess(revokeshareList);
       
        }
    }
}

Apex Class :

    public static void  provideAccess(List<Project__c > pros){
   
        List<Project_member__c> tmList=new List<Project_member__c>();
   
        map<id,Project_member__c> tmmap=new map<id,Project_member__c>();
   
        List<Project__Share> shareList=new List<Project__Share>();
   
       tmList=[select id,project__c,MasterDetailWithcontact__r.owner.id from Project_member__c where Project__c IN:pros];
        for(Project_member__c s:tmList){
       
            tmmap.put(s.Project__c,s);
       
        }
   
        for(Project__c rec:Pros){
       
            Project__Share share=new Project__Share();
       
            share.ParentId = rec.id;
       
            share.AccessLevel = 'Edit';
       
            share.RowCause = Schema.Project__Share.RowCause.Manual;
       
            share.UserOrGroupId = tmmap.get(rec.id).MasterDetailWithcontact__r.owner.id;
       
            shareList.add(share);
       
        }
   
        insert shareList;
   
    }

    public static void  revokeAccess(List<Project__c> pros){
   
        List<Project__Share> shareList=new List<Project__Share>();
   
        shareList=[select id from Project__Share where parentId IN:pros AND RowCause = 'Manual'];
   
        delete shareList;
    }
}

Result :

Once the project record is created into the database ,By default only owner of the record will have access to record as shown in Screenshot 2 :

Screenshot 2:



Once the above project record updated to the 'Assigned' status  ,Access of the project record will be shared to project team member . Please find the ScreenShot 3.

First Share record with all access Level belongs to the default record owner access . And Second Share record with Edit access and RowCause 'Manual' belongs to Share record created by above Apex trigger and Apex class.

ScreenShot 3 :





If you update the Status to 'Completed' again the 'Edit' access would be revoked/Deleted to all the Project Members associated to Project object.
*********************************************************************

What is apex trigger in salesforce,Triggers in salesforce,Apex triggers,Basic apex trigger examples in salesforce,Apex trigger real time scenarios ,apex trigger with hands on examples.

*********************************************************************
We hope you are clear with the process now .

If you still require further clarifications,Please let us know in the comments .

Please follow us for more salesforce concepts.
Happy Learning☺☺☺


Lightning Data Service Basics for Aura Components challenge passed/Completed ||Trailhead Challenge||Lightning Data Service||LDS

Lightning Data Service :


Lightning data service is similar to Standard controller in Visualforce page .We can make the server calls without using server side controller.
Lightning Data Service Basics for Aura Components trailhead module provides clear information about LDS with hands on examples .
If you find any difficulty in passing the challenge ,Please compare your code with the below written code

1.Manipulate Records with force:recordData


Use force:recordData to create two Aura components that display and edit the details of an account
Create Aura components to manage accounts. Use force:recordData to create a component that displays the details of a standard account record, and another component that allows for quick edits to that record.

Solution :Create accDisplay component with the particulars mentioned in the trailhead challenge .If you face any issues please compare your code with the below code and modify accordingly.  

accDisplay.cmp 

<aura:component implements="flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,force:lightningQuickAction" access="global" >
    <aura:attribute name="record" type="object"/>
    <aura:attribute name="accountRecord" type="object"/>
    <aura:attribute name="recordError" type="String"/>
    
    <force:recordData aura:id="displayrecord"
                      layoutType="FULL"
                      recordId="{!v.recordId}"
                      targetError="{!v.recordError}"
                      targetRecord="{!v.record}"
                      targetFields="{!v.accountRecord}"
                      mode="VIEW"/>
    
    <lightning:card iconName="standard:account" title="{!v.accountRecord.Name}">
        <div class="slds-p-horizontal--small"> 
            <p class="slds-text-heading--small">
                <lightning:formattedText title="Industry" value="{!v.accountRecord.Industry}"/> </p>
            <p class="slds-text-heading--small">
                <lightning:formattedText title="Description" value="{!v.accountRecord.Description}"/> </p>
            <p class="slds-text-heading--small">
                <lightning:formattedPhone title="Phone" value="{!v.accountRecord.Phone}"/> </p>
        </div>
    </lightning:card>
    
    <aura:if isTrue="{!not(empty(v.recordError))}">
        <div class="recordError">
            {!v.recordError}
        </div>
    </aura:if>
</aura:component>

2.accEdit.cmp

<aura:component implements="flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,force:lightningQuickAction" access="global" >
    <aura:attribute name="record" type="object"/>
    <aura:attribute name="accountRecord" type="object"/>
    <aura:attribute name="recordError" type="String"/>
    
    <force:recordData aura:id="recordEditor"
           layoutType="FULL"
           recordId="{!v.recordId}"
           targetError="{!v.recordError}"
           targetRecord="{!v.record}"
           targetFields="{!v.accountRecord}"
           mode="EDIT"/>

    <lightning:card iconName="action:edit" title="Edit Account">
        <div class="slds-p-horizontal--small">
            <lightning:input label="Account Name" value="{!v.accountRecord.Name}"/>
            <br/>
            <lightning:button label="Save Account" variant="brand" onclick="{!c.handleSaveRecord}" />
        </div>
    </lightning:card>
     <aura:if isTrue="{!not(empty(v.recordError))}">
        <div class="recordError">
            {!v.recordError}
        </div>
    </aura:if>
</aura:component>


accEdit.JS (Java ScriptController):

({
    handleSaveRecord: function(component, event, helper) {
        component.find("recordEditor").saveRecord($A.getCallback(function(saveResult) {
            if (saveResult.state === "SUCCESS" || saveResult.state === "DRAFT") {
                console.log("Save completed successfully.");
            } else if (saveResult.state === "INCOMPLETE") {
                console.log("User is offline, device doesn't support drafts.");
            } else if (saveResult.state === "ERROR") {
                console.log('Problem saving record, error: ' + 
                           JSON.stringify(saveResult.error));
            } else {
                console.log('Unknown problem, state: ' + saveResult.state + ', error: ' + JSON.stringify(saveResult.error));
            }
        }));}
})



2.Handle Record Changes and Errors


Use force:recordData to create a component that shows an error message if it is loaded with invalid data Build on the components you created in the previous unit challenge by adding notification handling to your components. If the edits in your editable component create an error, make sure the display component shows an error message.

accEdit.cmp:
<aura:component implements="flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,force:lightningQuickAction" access="global" >
    <aura:attribute name="record" type="object"/>
    <aura:attribute name="accountRecord" type="object"/>
    <aura:attribute name="recordSaveError" type="String"/>
    
    <force:recordData aura:id="recordEditor"
                      layoutType="FULL"
                      recordId="{!v.recordId}"
                      targetError="{!v.recordSaveError}"
                      targetRecord="{!v.record}"
                      targetFields="{!v.accountRecord}"
                      mode="EDIT"
                      recordUpdated="{!c.handleRecordUpdated}"/>
    
    <lightning:card iconName="action:edit" title="Edit Account">
        <div class="slds-p-horizontal--small">
            <lightning:input label="Account Name" value="{!v.accountRecord.Name}"/>
            <br/>
            <lightning:button label="Save Account" variant="brand" onclick="{!c.handleSaveRecord}" />
        </div>
    </lightning:card>
    <aura:if isTrue="{!not(empty(v.recordSaveError))}">
        <div class="recordError">
            {!v.recordSaveError}
        </div>
    </aura:if>

</aura:component>


accEdit.JS(Java ScriptController):

({
    handleSaveRecord: function(component, event, helper) {
        component.find("recordEditor").saveRecord($A.getCallback(function(saveResult) {
            if (saveResult.state === "SUCCESS" || saveResult.state === "DRAFT") {
                console.log("Save completed successfully.");
            } else if (saveResult.state === "INCOMPLETE") {
                console.log("User is offline, device doesn't support drafts.");
            } else if (saveResult.state === "ERROR") {
                console.log('Problem saving record, error: ' + 
                            JSON.stringify(saveResult.error));
            } else {
                console.log('Unknown problem, state: ' + saveResult.state + ', error: ' + JSON.stringify(saveResult.error));
            }
        }));},
    
    
    handleRecordUpdated: function(component, event, helper) {
        var eventParams = event.getParams();
        if(eventParams.changeType === "CHANGED") {
            // get the fields that are changed for this record
            var changedFields = eventParams.changedFields;
            console.log('Fields that are changed: ' + JSON.stringify(changedFields));
            // record is changed so refresh the component (or other component logic)
            var resultsToast = $A.get("e.force:showToast");
            resultsToast.setParams({
                "title": "Saved",
                "message": "The record was updated."
            });
            resultsToast.fire();
        } else if(eventParams.changeType === "LOADED") {
            // record is loaded in the cache
        } else if(eventParams.changeType === "REMOVED") {
            // record is deleted and removed from the cache
        } else if(eventParams.changeType === "ERROR") {
            console.log('Error: ' + component.get("v.error"));
            component.set("v.recordSaveError",v.error);
        }
    }

})

We hope you are clear with the challenge now .

If you still require further clarifications,Please let us know in the comments .

Happy Learning☺☺☺