Salesforce Lightning Interview QA

I have compiled some Interview Questions related to Salesforce Lightning that are given below:

1 – One User is viewing a Lightning Component in which some fields are being displayed and in the mean time some other user have changed the value of the field. How do you ensure that user will see the updated value?

Answer – Using platform event. Streaming API will not work into the Lightning Environment.

2 – What is Lightning Data Service(LDS) ? What are the benefits of using LDS?

Answer – LDS is a standard controller for Lightning Component. Using Lightning Data Service we can Create, Retrieve, Delete and update records for which we do not need to write the apex class. Lightning Data Services ensures the FLS by itself. For more info see Here.

3 – When we can not use LDS in Lightning Component?

Answer – LDS is used for single record so when we are dealing with Bulk records then we can not use LDS.

4 – What is main difference between Lightning Component and Visual Force Pages OR Why we should go for Lightning Component?

Answer – Visualforce components are page-centric and most of the work is done on the server. Lightning is designed from the component up, rather than having the concept of a page as its fundamental unit. Lightning Components are client-side centric, which makes them more dynamic and mobile friendly.

5 – Will Lightning Components be replacing Visualforce?

Answer – No.

6 – Is Lightning an MVC framework ?

Answer – No, it’s component based framework.

7 – What aura:method does in Lightning Component?

Answer – We can Use aura:method to define a method as part of a component’s API. This enables us to directly call a method in a component’s client-side controller instead of firing and handling a component event

8 – How many Components can be used in a single lightning application?

Answer – There is no Limit.

9 – Will Visual Force page will stop working on Lightning UI?

Answer – No, VF page will work in the Lightning UI as Classic UI.

10 – Can we include external Library into Lightning Component?

Answer – Yes, we can include multiple library into Lightning component.

More QA updates soon 🙂

Salesforce Lightning Interview Questions & Answers

In this post, I am going to post some useful questions and answer related to Salesforce Lightning environment.

  1. What are the type of events into Salesforce Lightning component
    1. Application Event(Salesforce Document)
    2. Component Event
    3. System Event(Salesforce Document)
  2. What is the basic difference between Application Event and Component Event
    1. The major difference between application and component event is that component event is used in the child to parent components and application event can be used throughout the application and any component can handler the application event.
  3. Which interface need to implement so that you can use the lightning component as the quick action.
    1. force:lightningQuickAction
  4. Which interface need to implement so that you can use the lightning component as Tab like custom object and VF page.
    1. force:appHostable
  5. Can we use Lightning Component into VF page? If yes how?
    1. Yes, using lightning out the functionality of the salesforce lightning component.
    2. For more details see Here
  6. How can we call child component controller method from the parent component controller method?
    1. Yes, we can call using aura methods.
    2. Salesforce Document
  7. What are the different Lightning component bundles?
    1. Component
    2. Controller
    3. Helper
    4. Style
    5. Document
    6. Design
    7. SVG
    8. Renderer
    9. More Info Here(Salesforce Document)
  8. What is the use of Document and Renderer in the lightning component?
    1. Document: – A description, sample code, and one or multiple references to example components
    2. Client-side renderer to override default rendering for a component.
  9. How to ensure FLS while working with Lightning Component?
    1. Lightning Data Services already ensures Field Level Security and we can also use the Apex using isAccessible, isCreateable, isDeleteable, isCreateable and etc methods of Schema class.
  10. Why we should go for Lightning Component instead of VF pages?
    1. See Here
  11. What is the difference between a lightning tag and UI tags?
    • A lightning tag has inbuilt SLDS we do not need to put extra effort to improve the look and feel, also it has may awesome tags to handle the Error or bad inputs. Error handling is very easy for lightning tags.
  12. What is the Difference between Lightning tags and Force tags?
    • The main difference between the Lightning tags and force tags is force tags works as apex:inputField tags work on the VF page. For example, if we are using forceInputField for the picklist field then it will show the input in picklist format with the respected values. It also supports the lookup/master input fields
  13. How can we navigate from one component to another component?
    • Yes. With the help of lightning:navigate tag and then use the page reference in JS Controller.
  14. In case of Parent to Child Component why we should use Component event instead of Application Event?
    • Because of the security issue as Application Event can be handled by any component so sensitive data be compromised

Happy reading and All the Best  🙂

I will keep updating the questions and answers.


Salesforce Interview Q & A Series Part-III

CSC Company Round 1

1 – What is with sharing, without sharing keyword? Why we use without sharing keyword?

Use the with sharing or without sharing keywords on a class to specify whether or not to enforce sharing rules.

The with sharing keyword allows you to specify that the sharing rules for the current user be taken into account for a class. You have to explicitly set this keyword for the class because Apex code runs in system context.

Use without sharing keyword where you want to run the class in System Context means with Admin Rights.

2 – There are 2 VF pages.VF1, VF2. There is an apex class C1 which is being used as a extension on a page with a standard controller. Can we use C1 class as a controller on VF2 page. If yes how? Should we need to do any changes in the C1 class for this.

Yes, We can use. No, We do not need to make any changes into Class C1

3 – Difference between Standard Controller, Custom Controller, an Extension, and Standard Set Controller?

Standard Controller: – These are the controllers defined by salesforce and we can fetch all the field values for a single record in VF page. Every Object (Standard and Custom) already have a standard Controller.

Custom Controller: – the Custom controller is Apex class instead of Standard Controller. We can use Standard Controller or Custom Controller in VF page

Extension: – Extensions, are Apex classes used to extend the functionality of Standard Controller.

Standard Set Controller: – There is nothing like Standard Set Controller in Salesforce but we can use recordSetVar attribute along with var attribute in VF page to display all the records of any Objects and this is called as Standard Set Controller

4 – Best practices of test class?

  1. Use @isTest at the Top for all the test classes
  2. Always put assert statements for negative and positive tests
  3. Use the @testSetup method to insert the test data into Test class that will flow all over the test class.
  4. Always use Test.startTest() and Test.stopTest() doing this it will increase the governor limit of salesforce. We also use this to increase the governor limit.
  5. Use System.runAs() method to test the functionality in user Context.
  6. Do not put (seeAllData = true) in test class otherwise, use for exceptional cases.
  7. Avoid Using Hard Coding Ids anywhere in test Class or any apex class.
  8. Please make sure that each class has minimum 75% coverage and also the main functionality has been covered. If possible increase code coverage up to 95%.
  9. All class method must be tested for at least 200 records and keep the real scenarios in mind.
  10. Only one Test.startTest() and Test.stopTest() statement can be in a method, and no of Test.startTest() and Test.stopTest() statement in any test class depend upon the test methods.

5 –  Junction object J1 connect with two object O1, O2 which object permission J1 will have?

If O1 is primary Object then J1 will have O1 permission. If O2 is primary Object then J1 will have O2 permission.

Primary Object is that Object is created the first Master-Detail relationship.

6 – There are 4000 records of opportunity, we need to find out the sum of the amount on all the records. How will we find it?


7 – Trigger ABC on account (before insert){





Will it be saved or not? It will produce runtime error or compile time error?

It will save without any error but will produce Run Time Error.

8 – Can we call a batch from other. There are 3 batches A B C how will call these from each other?

Yes, we can call another batch from finish method.

9 – Can we make callout from the batch?

Yes, For this we need to implement the database.AllowCallouts Interface

global class SearchAndReplace implements Database.Batchable<sObject>,

10 – Limit of no of callouts in Apex class and Ape Batch?

Apex Class: – 100 Callouts in a Single Transaction

Apex Batch: – The start, execute, and finish methods can implement up to 100 callouts each.

11 – Test class for web services classes?

How will you do it? It will depend on the type of Webservice it may be Http or WebService. For HTTP we need to make a MockCallout class which will implement HttpcalloutMock interface and its method which will return Httprespond. AND for Webservice, we need to Implement WebservicecalloutMock interface and its global method which is of void type. Method signature global void doInvoke(no of parameters).


global class testtest2 implements HttpCalloutMock {

   // Implement this interface method

   global HTTPResponse respond(HTTPRequest request) {

       // Create a fake response

       HttpResponse response = new HttpResponse();


Test.SetMock(HttpCallOutMock.class, new testtest2());

12 – What is static variable?

Static variables are class level variable and will persist their values in the entire transaction. Can be accessed directly with the class name.

13 – What do you prefer in test class?

75% code coverage

Business Logic Functionality

14 – Use of test.starttest and test.stoptest()?

To reset and increase the governor Limit while test cases are executing.

15 – How many Test.startTest in a test class?

1 in every test method and depend upon the no of methods in test Class.


CSC Company Round 2

1 – How to query Deleted records using SOQL query?

SOQL statements can use the ALL ROWS keywords to query all records in an organization, including deleted records and archived activities.

For example: [SELECT COUNT() FROM Contact WHERE AccountId = a.Id ALL ROWS]);

Note: it only works in apex code, not on developer console.The query editor doesn’t use Apex Code– it executes directly as a REST query API call. There’s no way to query deleted records from the developer console’s query editor at this point. Use the Apex Data Loader (Export All), or the workbench (

2 – How to lock any sObject records?

To lock a set of sObject records in Apex, embed the keywords FOR UPDATE after any inline SOQL statement. Account [] accts = [SELECT Id FROM Account LIMIT 2 FOR UPDATE];

3 – Why implements interface not class in batch?

Interfaces provide a layer of abstraction to your code. They separate the specific implementation of a method from the declaration for that method. This way you can have different implementations of a method based on your specific application.

Refer this Link

4 – We need to restrict the no of child=2 on a master object. How will do this only using configuration?

I am still looking for the answer 😛 😛 😀 😀

5 – Can we create a record using workflow rule?

No, we can not create records using workflow rule

6 – Can we update Trigger.New list in After Insert and After update Event?

No, if we do then we will get the record is readonly error.

Important Salesforce Interview Questions of different Companies

Accenture Interview Questions

1)   What is Dynamic Approval process?

2)   The flow of execution in the validation rule, triggers & workflows?

3)   Assignment process & validations.

4)   Difference between & Trigger.old?

5)   Trigger events? & context variables?

6)   Batch Apex?

7)   Will one workflow effects another workflow?

8)   Syntax for upsert & undelete trigger & Purpose undelete?

9)   Case management?

10)   If we want to upload data through DataLoader, what the changes to be done?

11. write a trigger on Account, While inserting a text value as ‘someName’ ended with ‘text’ ex: ‘renuText’ On Account Object it should through an error. How you will achieve this…??
12. How you will write Validation rule for above scenario while inserting the record and Validation rule should not fire while updating form workflow it should accept.
13. In one of the object, there are two fields called Field1 and Filed2 exist and we have 100,000 records, out of 70,000 record values are equal in field1 and field2. Now Display those 70,000 records on the visualforce page.
14. In an Account Object a field called ‘Sales Person‘ and it has lookup relation with the user object. If the user is selected as the salesperson for a record, that user able to see those records, but OWD is private, record owner and admin will not share any records.

15. Soap & REST Difference and in which format these are used to send and receive.
16. How to get the external ID from other system and update it in Salesforce ExternalID field, if you get null value from another system how you will through an error.
18. Why we use @future annotation?
19. What is an asynchronous process and why it is needed?
20. What is the purpose of using with sharing and without sharing?

Deloitte F2F Interview Question

1 – We have 3 objects Account, Contact, Opportunity.   In a VF page, we need to display the names of contact & Opportunity which are related to Account.

2 – One object (s1) & 3 tasks (t1, t2, t3) are there. Each task performing discount related stuff.   Write a trigger that should calculate the sum of 3 tasks.  And if any task is modified than trigger should fire automatically & perform the same.

Ans: List listoftasks = [select id, name from Task where];

3 – How can you convert a lead?

4 – What is your Role in your project?
5 – Explain 2 VF pages developed by you?
6 – How will you deploy? Have you ever involved in deployment?
7 – How will you test your code through Sandbox?
8 – What are the custom settings? Types?
9 – Difference between SOSL and SOQL in Salesforce?
10 – What is Sales cloud & Service cloud?
11 – can a Checkbox as controlling field?
12 – SOQL & SOSL? Diff between SOQL & SOSL?
13 – Difference b/w External ID & Unique ID?

14 – What is System.RunAs () is test class?
15 – Explain  Test.setPage ()?
16 – Why Governor Limits are introduced in

TCS F2F interview

1 – About project?
2 – What are standard objects used in your project?
3 – Governor Limits?
4 – How many types of relationship in Salesforce.
5 – Have you experience Data Migration?
6 – What is the Roll-up summary field?
7 – What is the difference between sales cloud & service cloud?

Capgemini f2f Interview Questions

1) Briefly, explain about yourself?

2) What is Salesforce architecture?

3) What all the services provided in cloud computing?

5) What is the difference between profiles and roles?

6) What are web services? why we need to go for them? What is WSDL? What is SOAP?

7) Here you attended Capgemini written test. If you got selected here you will be sent to technical round..if you got selected in the technical round then you will be sent to HP for client interview, because HP is the client to Capgemini. If you got selected finally.Then you will be put into work.  This is the scenario. which process do you apply here either “WORKFLOWS” or “APPROVALS“.

9) How you will make a class available to others for the extension? (Inheritance concept)

10) In the process of creating a new record, how you will check, whether the user has entered email or not in the email field of Account object? Validation Rules

11) How you will write a javascript function that displays an alert on the screen?

12) What is the value of “renderas” attribute to display o/p in the form of Excel Sheet?

13) How you will get the javascript function into the Visual-force page?

14) Can we create a dashboard using the Visual-force page? and what all the components we use here?

15) What are web tabs?

16) How you will add an attachment from VF page? tell me the component names to achieve this functionality?

17) Security(OWD, Sharing Rules, Manual Sharing).

18) Rate yourself in salesforce?

21) You will be given pen and paper, they will ask you to write some simple code.

American Express F2F Interview Questions

1)  What is the trigger in Salesforce? Types of Trigger?

2)  What are default methods for Batch Apex?

3)  Analytical snapshot?

5)  Other than Data Loader any other way to import Bulk Data?

6)  Explain any scenario occurred you to work beyond Governor Limits?

7)  How u will do Mass Insert through trigger?

7)  How u will do Mass Insert through trigger?

8)  If I want to Insert, Update any record into ‘Account’. What trigger I have to use?


1) There is a field billingAddress in company object. Whenever a new employee is inserted or an old one is updated employee’s billing address should be copied to company’s billing address. The company is master and employee is the child. Write trigger.

2) There is a checkbox__c in opportunity. Write a batch class to update(checkbox__c  = true) in all the opportunity which is created in last 1 hour.

3) Write a trigger to delete all the contact created while lead conversion. Prevent the contact creation while Lead conversion. Is this possible?

4) Write SOQL query to get all the Account having contact.

5) Write SOQL query to get all the Account having no contact.

6) Write SOQL query to get all the Account having lost opportunity.

F2F HytechPro Questions

1 – What is fieldset in Salesforce? Field Set
2 – What are setup and non-setup objects in Salesforce?

3 – Write a trigger to insert a contact and user when the account is created.

4 – What is Mixed DML and how would you handle it.

5 – What are lightning components? Have you ever developed any lightning Component?
6 – Does your company works on Lightning component or Lightning Experience?

7 – Responsive Email templates?


Salesforce Interview Q & A Series Part-II

Hello All, I am here with the next part of Questions and answers series.

16 – Difference b/w trigger and workflow?

workflow rule:- It is an automated process that fired an action based on evaluation criteria and rule criteria.

We can access a workflow across the object.

We can not perform DML operation on Related Objects. Only Master Object field can be updated in case of Master-Details Relationship.

We can not query the database.

Workflow action:- Email alert, Create task, field update, outbound email message

Trigger: – it is a piece of code which executed when the record is before and after of created, updated, deleted and after the record is undeleted from the recycle bin.

We can query the data from the database.

We can Query other related Objects and also can make DML on the same and related objects as well.

Unlike workflow, we can perform any task using apex trigger.

17 – What are Wrapper Classes in Salesforce? Give an example where you can use wrapper class!

A wrapper class in Salesforce is a Container Class which contains Objects, Collection of Objects, variables, Collection of other classes as its member. We can also say that a wrapper class is a custom object that Programmer defines to achieve the business need and defines the properties inside the class.

Example: – We can use the Wrapper class in the following scenarios

a) In the Visualforce community boards, one of the most commonly asked questions is, “How can I display a table of records with a checkbox and then process only the records that are selected?”.

Wrapper Class

b) OR we can use Wrapper class when we want to show the list of data in VF page or in any other classes of the many objects that are not related to each other.

18 – Difference b/w SOQL and SOSL?

SOQL: Salesforce Object Query Language, we can query all the fields, search one object at a time, perform DML operation on the query result.

Total number of records retrieved by SOQL queries – 50K

SOSL: Salesforce Object Search Language, we can query only text, number, email type fields, we can search for the different object at a time. If we are looking for the particular text that is available in any objects then we use SOQL like global search in salesforce and we can not make DML on the returned list.

Total number of records retrieved by a single SOSL query – 2000

Introduction to SOQL and SOSL

19 – Difference b/w Insert and Database.insert?

Insert – Insert and Database.insert method are same but Database.insert method provide you more flexibility as compared to Insert Method. If there is any exception while making DML using insert then All records will be aborted.

Database.Insert – Using Database.Insert method you can specify whether you wanted to abort the complete records when there is an error in any records or commit the success record and show a list of failed records. It also provides the Rollback functionality.

20 – What is the static resource?

Static resources allow you to upload content that you can reference in a Visualforce page, including archives (such as .zip and .jar files), images, style sheets, JavaScript, and other files.

A single static resource can be up to 5 MB in size, and an organization can have up to 250 MB of static resources, total.

Creating a Static Resource

21 – How to call javascript through Static Resource on VF page?

<apex:includeScript value=”{!$Resource.Myscript}”/>

22 – What are workflow Actions in Salesforce?

Create a Task, Update a field, Email alert, Outbound message.

23 – How many ways we can be made field is required?

From Layout, Validation rule, at the time of Field creation.

24 – Difference b/w role and profile?

R for records means Role deals with records level security and Profile deals with Object Level access.

profiles control object – and field-level access

Roles influence record-level access

A role is the record level access and it is not mandatory for all the users.

The Profile is the object and field level access and it is mandatory for all the users.

25 – Difference b/w rendered, rerender, renderaspdf?

Rendered: – To show/hide the particular panel, field based on conditions. for example, if input 1 is not blank then show input 2 here we can use Rendered

Rerender: – Used for refresh the Output Panel

RenderasPdf: – To open the Vf page as PDF format

26 – What are standard Junction Object present in Salesforce?

OpportunitycontactRole, Pricebook Entry, Opportunity product

27 – Difference b/w action support, Action function?

ActionSupport ActionFunction
1) Directly call action method without javascript Call action method from javascript with AJAX
2) It can be used to call action method on  single event It can be used to call action method on different event
3) It can not be called from javascript function.It only invokes controller action methods from other Visualforce components It defines a new JavaScript function which can then be called from within a block of JavaScript code.

28 – How many controllers can be used on VF page?

Salesforce comes under Saas so we can use one controller and as many extensions

29 – Can we create Master-Detail relationship in the Object which already have existing records?

Directly we cannot create. But, If we want to create then we need to do the following steps

  1. Create a Lookup relationship field on the Object
  2. Fill all the Lookup values with the correct master records ids
  3. Then Go back to the lookup field and then change From Lookup to Master-Detail

30 – Can we convert Master-Detail field to Lookup field?

Yes, we can but if Master Object does not have any Rollup Summary field then only we can.

31 – Is it possible to delete junction – Object in case of Mater – Detail Relationship?

If the parent objects don’t have Roll up Summary fields for the child object then we can delete.

To delete a child object it should not be referred to Apex Classes and Apex Triggers.

Later if we undelete the object, Master-detail fields on the junction objects will be converted to look up Fields.


If we delete only Master-Detail Relationship field from the child object and undelete it from the Recycle Bin then it will be converted to look up the relationship.Parent Object we cannot delete because it will be referred

Parent Object we cannot delete because it will be referred in the child object.

32 – What will happen if we undelete the deleted Junction Object?

Master-Detail Relationship data types will be converted to look up related data types.

Salesforce Interview Q & A Series Part-1

The more experienced we are, the more we grow to understand that the questions we ask or the answers we give in an interview say a lot about our enthusiasm and level of interest for a product, company, or organization.

I am going to publish of series of questions here, this is part 1

1 – What is App in Salesforce?

An app is a group of abs which works as a unit to provide a functionality. The user can switch on the another app by using the dropdown list.

2 – What is Object in Salesforce?

Objects are most likely Database tables in other databases like (Oracle, MySql, etc). Objects are of 2 Types. Standard and Custom Objects. Standard Objects are those that are already present into Salesforce CRM like Account, Contact, Lead, Opportunity, and etc, Custom Objects are that we create to fulfill our business need. Objects are used to store the data into Database.

3 – How many relationships included in SFDC & what are they?

Relationships in salesforce are given below: –

a) Master-Detail Relationship

b) Look-up Relationship

c) Self Relationship

Relationships Among Objects

Create Object Relationships

4 – What is view state?

View state holds the state of the visualforce page, holds the state of fields, component and controller state. Whenever you will use the <apex:form> tag in VF page view state will automatically be created and saved in encrypted format. Max limit for view state is 135KB.

5 – Vf page size?

Less than 15MB

Visualforce Limits

6 – What is Future Method and when to use it? Give a scenario where we can use the future method.

Future methods run asynchronously that means when resources will be free future methods will execute most likely Queable Apex and Batch Classes.

We use future method methods to avoid the Mixed DML operation!

Example: – If we are making DML on any setup Object like User, UserGroup, PermissionSet, and etc and then after making the DML on any non-setup objects like Account, Contact, and etc then we will face Mixed DML error and to avoid this error we will use the future method. We can put any one of the DML operation inside the future method.

7 – What is Lookup Relationship in Salesforce?

Lookup relationship is used to connect one Object records with another object records, we can create up to 25 lookup relationship into an Object.

The lookup field is not required one while creating the child object record.

If we delete the master record in lookup relationship then child record will not be deleted from the database only value in lookup field will be deleted.

If we undelete the Lookup field from recycle bin then the value in lookup field will be restored.

8 – What is Master-Detail Relationship in Salesforce?

Like Lookup relationship, the master-detail relationship is also used to connect one object to another object. We can create only 2 Master-Detail relationship field into an Object and it works vice-versa.

Master-Details field is required while creating the Child Records.

Child records will be deleted if we delete the master record.

If we undelete the master record from recycle bin then, child records will also be undeleted means restored into the database.

We can create Rollup Summary fields into Master Object.

9 – What is the RemoteAction annotation in Salesforce?

The RemoteAction annotation provides support for Apex methods used in Visualforce to be called via JavaScript. This process is often referred to as JavaScript Remoting. It will not count in view state. We often use JavaScript Remoting to develop the complex VF pages that can not be created using standard AJAX functions.

JavaScript Remoting Example

10 – How to download the VisualForce page as excel in Salesforce?

<p style="padding-left: 30px;"><span style="font-weight: 400;"><apex:page controller="contactquery" contentType="application/" cache="true"></span></p>
<p style="padding-left: 30px;">

11 – How to create many -to-many relationship?

We can create the Many-to-Many relationship in Salesforce using Junction Object.

Example: – We have 2 Objects called Bug and Program. A bug can be related to multiple programs and a program can be related to multiple Bug. So, to find this which bug is related to which program, we will create a new custom object with 2 Master-Detail Relationship of Bug and Program Object.

12 – What is Junction Object in Salesforce?

A custom Object with 2 Master-Detail Relationship is Called as Junction Object.

13 – What is the tab in Salesforce? Type of tab?

The tab is the user interface component for displaying the custom object data.

Types – Custom Object Tab, Visualforce Tab, Web Tabs and Lightning Component Tabs!

14 – List things that can be customized through page layout?

Fields, related list, buttons, custom links, we can also create sections.

15 – Self-relationship in Salesforce?

It is a lookup relationship to the same object.


I will post the next part of this series ASAP. Enjoy reading 🙂 😀 🙂