You are on page 1of 27

1. What is Aura Framework?

Aura is an open source framework developed by Salesforce. It is a component based framework to develop UI
components.

2. What is Lightning Framework?


Lightning Framework is based on Aura Framework to design and develop Salesforce Aura components.
Lightning framework is also developed by Salesforce, but unlike Aura Framework, it is not open source.

3. In which Salesforce release, Lightning Components were introduced?


Lightning was introduced in Salesforce Winter 15 release.

4. What is event driven architecture?


Event-driven architecture is used for better decoupling between components. Components can communicate with
each other using events. Lightning Framework supports two type of custom events:

1. Component Event
2. Application Event
Any component can subscribe to an application event, or to a component event they can see.

5. From where can you create Aura Components?


Aura Components can be developed using your favorite IDE (VS Code, Eclipse, IntelliJ) or directly through
Developer console.

6. What is a Component Bundle?


Component bundle is a folder or pack, which holds all the component files together or differentiate from the files
of the components. For ex, An aura component can have upto 8 different files which all are part of component
bundle.

7. What are different files in an aura component bundle? What are their usage?
There are 8 different files in a component bundle. These files include component markup, css, javascript and
documentation. For ex, let’s say you have component bundle named as “MyCustomComponent”, then the
component files would be:

MyCustomComponent Bundle
| — MyCustomComponent.cmp
|              Only required resource in component bundle. Contains markup of the component in xml format.
| — MyCustomComponentController.js
|              Client side controller based on javascript to handle events raised by component
| — MyCustomComponentHelper.js
|              Contains Javascript functions that can be called from controller file of renderer file. This file mainly
used for writing reusable code.
| — MyCustomComponent.css
|              Style for the component. Contain css classes and style definitions
| — MyCustomComponent.auradoc
|              Contains description, sample code or reference to your component
| — MyCustomComponentRenderer.js
|              Client-side rendering to override default rendering
| — MyCustomComponent.design
|              Enables you to design a form that enables business user to set value attributes in your component using
Lightning App Builder.
| — MyCustomComponent.svg
|              Custom icon resource
8. What are different JavaScript files in a component bundle?
There are 3 JavaScript files in an Aura Component Bundle, Controller File, Helper File and Renderer File.
Controller file is mainly used to handle events being fired from component markup. Helper file is mainly used to
write reusable code. Renderer file is mainly used to override rendering events of an Aura Component.
9. What are different ways to call a javascript controller method?
Javascript Controller method can be called via:

 By browser events like onclick, onchange etc


 By Aura handlers of lifecycle events init handler, render handler
 By Aura handlers of component and application events
 By Aura Method
Read Also – Interview Questions – Lightning Framework – Part 1
10. How many parameters are there in a javascript controller method?
There are three parameters that a javascript controller method accept.

 Component – Component or markup file reference


 Event – It has all the properties of the event which fired this method
 Helper – Helper file reference
These parameters are supplied by the framework itself and does not need to be passed explicitly.

11. Can we call one javascript controller method from other one?
No, javascript controller method can only be called by component markup.

12. Can we call one helper method from other helper method?
Yes, Helper file methods can be called from controller methods, other helper methods or from renderer file
methods as well. Helper file is designed to put reusable code hence this code can be called from all javascript
resource files.

13. What are different events fired during component rendering lifecycle?
During component rendering, there are several events which gets fired.

 Init event – The component service that constructs the components fires the init event to signal that
initialization has completed.
 Render event – This event is called when component starts rendering. You can override this either by
handling this event, or by creating custom renderer resource file.
 After render – This event is called once rendering is completed.
Read Also: Code By Code – LWC – Chapter 1 – Why Lightning Web Components?
14. What is inheritance in Lightning framework?
Lightning framework allows you to extend another component. When a component extends another component,
we refer to sub and super components in the inheritance hierarchy. This inherits super components properties and
make them available to sub component.

15. What is inherited?


When one component extends another, it inherits super component’s attributes, events, controller and helper.
You can use all these properties in your sub component.

16. What are the general steps to implement inheritance?


To implement inheritance, you need to complete below steps:

 Create a parent component and make it extensible. This will allow your component to be inherited by
other components.

 Create another component and extend first component.


17. What are component events?
Component events allow you to make a communication channel within same hierarchy. A component event is
fired from an instance of a component. A component event can be handled by the component that fired the event
or by a component in the containment hierarchy that receives the event.

A component event cannot be handled by any component which is below in the component hierarchy or out of
the hierarchy.

 Events fired from c:second component cannot be handled by c:thirdComponent since it is out of
component hierarchy. It cannot be handled by c:fourthComponent as well, since it is below
c:secondComponent in component hierarchy.
18. What are the steps to fire and handle a component event?
 Create a component event.
 Register the component event in the aura component from where you intend to fire it.
 Fire the component event using fire() method.
 Declare an aura handler in your component where you intend to handle the event.
19. How can you handle the component event?
Component events can be handled either by aura:handler or directly from child component declaration tag. For
example, if c:secondComponent fires a component event named “onBack” than you can handle that directly from
c:firstComponent like below:

<c:secondComponent onBack=“{!c.handleBack}” />

20. What are different phases for component event propagation?


The framework supports capture and bubble phases for the propagation of component events. These phases are
similar to DOM handling patterns and provide an opportunity for interested components to interact with an event
and potentially control the behavior for subsequent handlers.
Read Also – Interview Questions – Lightning Framework – Part 2 – Inheritance
21. What is capture phase in component event propagation?
The event is captured and trickles down from the application root to the source component. The event can be
handled by a component in the containment hierarchy that receives the captured event.

Event handlers are invoked in order from the application root down to the source component that fired the event.

Any registered handler in this phase can stop the event from propagating, at which point no more handlers are
called in this phase or the bubble phase.

Source component is the one who is firing the event. Application root here is the top-most component in
component hierarchy.
22. What is bubble phase in component event propagation?
The component that fired the event can handle it. The event then bubbles up from the source component to the
application root. The event can be handled by a component in the containment hierarchy that receives the
bubbled event.

Event handlers are invoked in order from the source component that fired the event up to the application root.

Any registered handler in this phase can stop the event from propagating, at which point no more handlers are
called in this phase.

Source component is the one who is firing the event. Application root here is the top-most component in
component hierarchy.
Read Also – Interview Questions – Lightning Framework – Part 1
23. What is default phase in component event propagation?
Bubble phase is the default phase for component events.

24. How you can stop further propagation of a component event?


stopPropagation() method is used to stop further propagation of the event. This will stop the event at current
element itself and it will not traverse the rest of the path.

25. What is the base aura tag for component event?

<aura:event type=“COMPONENT” />

26. How to find source/root of component event?


In the client-side controller action for an  tag, use evt.getSource() to find out which component fired the event,
where evt is a reference to the event. To retrieve the source element, use evt.getSource().getElement().

Below is the comprehensive list of questions


asked in Salesforce Lightning Interview
Questions.
1. What are the type of events into Salesforce Lightning component?
a. Application Event – Scope of this event is throughout the lightning App and any component which has registered
for this event would get a notification.
b. Component Event– Scope of this event is within itself or the parent component of this event, all the components
declared within the parent component would get notified of this event.
c. System Event- these are the events fired by Salesforce’s system during the lifecycle of the lightning app.
2. What are the basic differences between Application Event and Component Event?
Component events are used to do communication between child and parent. They use bubbling and capture same as
used in DOM events. A change in a child component can be communicated to the parent component via component
event.
Application events are used to communicate any change in the component to a broader audience. Any component
who has registered for this event will get a notified.
To use Component Event API we use the below syntax
3. When should we use Component event and application events?
It is best to always use a component event instead of an application event. Component events can only be handled by
components above them in the containment hierarchy, therefore, their usage is localized to the components that need
to know about them.

Application events are best used for something that should be handled at the application level, such as navigating to a
specific record. Application events allow communication between components that are in separate parts of the
application and have no direct containment relationship.

4. Which interface we are supposed to implement so that a lightning component can be used as quick action?
We need to implement the following “force: lightningQuickAction” so that we can use the component as a Quick Action

5. Which interface we are supposed to implement so that a lightning component can be used as a Tab?
We need to implement the following “force:appHostable” so that we can use the component as a Tab

6. How can we use a lightning component in a VisaulForce Page? Explain?


A Lightning component can be embed in any webpage using a very powerful and flexible feature, Lighting out. When
used with Visualforce some complexity becomes simpler.
Lightning component can be added to Visualforce page in three steps:
1. We have to first Add the Lightning Components for Visualforce JavaScript library to your targetted Visualforce page
using the tag.

2. Next we have to create and refer a Lightning app which is used to the component dependencies.

3. Lastly we need to write a JavaScript function which will finally create the the component on the page using
$Lightning.createComponent()

7. How can we call child component controller method from the parent component controller method?
To call a child component’s controller method, we need to first create a aura:method which is publically accessible,
aura:method is used to communicate down the containment hierarchy i.e. parent to child. Sample code for
implementing the aura method:
Component code
Controller
({
publicmethod: function(cmp, event) {
var params = event.getParam(‘arguments’);
if (params) {
var message = params. str;
console.log(“message: ” + message);
return message;
}
}
})
Calling the cild method from parent controller
({
callchildCompMethod : function(component, event, helper) {
var childCmp = component.find(“childCompName”);
var Result =
childCmp. publicmethod (“message sent by parent component”);
console.log(“Result: ” + Result);
}
})
8. What are the different Lightning component bundles?
a. Component
b. Controller
c. Helper
d. Style
e. Document
f. Design
g. SVG
h. Rendrer
9. How to ensure FLS while working with Lightning Component?
FLS and CRUD are not automatically enforced in the lightning component whenever any object is referenced in the
Apex Controller and the component will display the fields and records for which the users do not have access.
Therefore we should manually enforce the FLS and CRUD in the Apex Controller, or we should try to use Lightning
Data service wherever possible because it takes care of FLS and CRUD for us.

10. How can we use Lightning Components with the Salesforce1 Mobile App ?
For this purpose we need to first make a lightning tab which points to the lightning component we created and then we
have to include that tab in the salesforc1 Mobile Navigation select list and the newly created tab to it.

11. Can we make a Lightning Component that shows up in both the mobile and the desktop user interfaces?
Lightning component is lightning experience ready by default and is also compatible in Salesforce1 App, it has a
responsive layout therefore it adjust its resolution according the screen size and therefore can be used on desktop as
well without writing any separate code.

12. Is Lightning component framework an MVC framework ?


No it is not a MVC framework it is a component based framework and event driven.

13. Which parts of Lightning Components are server-side and which are client-side ?
Lightning components have two types of controller, one which uses javascript and responds to the event occurring in
the components at client side and the second controller which is an apex class. Method of apex controller are
accessed by the JavaScript controller methods asynchronously.

14. Can we make one component inherit styles/CSS from a parent component, or must we always define it in
the component ?
Child component inherits the CSS from its aren’t we do not need to specify it for each component

15. What is the use of the aura:method tag in Lightning ?


aura:method is used to communicate down the containment hierarchy i.e. parent to child

16. Can we Include One Lightning component to another ?


Yes we can include one Lightning component in another Lightning component

17. Is there any limit on how many component to have in one Application?
There is no limit on number of components defined within an application by salesforce

18. Is Lightning Components replacing Visualforce?


No Lightning component is not replacing Visualforce, Visualforce is still supported by Salesforce.

19. What is Aura? Why do we use the aura: namespace in the code?
Aura is a UI framework for developing dynamic web apps for mobile and desktop devices. Aura provides a scalable
long-lived lifecycle to support building apps engineered for growth.

Aura supports partitioned multi-tier component development that bridges the client and server. It uses JavaScript on
the client side and Java on the server side.

20. Do we need a namespace to develop Lightning Components?


You can have namespace in your org but it is not necessary to have a namespace to develop lightning component.

21. What are the tools included in lightning?


Lightning App Builder – It is a tool with User interface to use drag and drop functionality and create app fast by reusing
the components, components can be standard or custom depending upon your requirement.
Lightning Component Framework- it provides a bundle that can be used to build reusable custom components,
Standalone App and to customize Salesforce1 App
Lightning Connect – it is a powerful tool to facilitate the integration of force.com app with an external data source using
OData specification
Lightning Process Builder – it is a visualization tool to build automation required for your business processes.
Lightning Schema Builder – it is a visualizing tool to view, create objects fields and relationship among them.
22. What is difference between Visualforce Components and Lightning Components?
Visualforce page is created keeping page as the center of the application and most of its calculation is performed at
the server side. Lightning component on the other hand are created using the component based framework, most of
the calculations are performed at the client side and makes the more dynamic and provide rich customer experience,
also lightning component are build using mobile first approach.

23. Does Lightning work with Visualforce ?


Yes Lightning component works with Visualforce by implementing Lightning out as discussed earlier.

24. Are there any CSS (styles) provided by salesforce.com as part of the supported Lightning Components ?
Salesforce has provided lightning design system as the default css to be used with Lightning component.

25. Are Lightning Components intended only for mobile apps?


Although lightning framework creates component keeping mobile first approach, but its responsive design helps in
providing the same experience over the desktop without writing separate lines of code

26. What are the advantages of lightning?


There are many advantages of using lightning like its out of the box component set which enables the fast paced
creation of new apps, its event driven architecture which enables the easy decoupling between the components.
Device awareness, cross browser compatibility and framework optimized for the performance.

27. Can we integrate Lightning components with another framework, such as Angular?
Yes we can integrate lightning with any 3rd party framework.

28. Can we include external JavaScript/CSS libraries in components?


It is possible to use custom CSS and JAvascriipt in the Lightning component

29. What happens with existing Visualforce Pages in Lightning Experience?


Most of the Visualforce page can be easily converted to lightning experience, but they are still supported by the
salesforce and are not required to be converted

30. Where we can display lightning component?


Lightning component can be displayed at following places:
1. Lightning Experience
2. Salesforce1 App
3. Template-based Community
4. Standalone Lightning App
5. Visualforce Pages (Using Lightning out )
31. Do I always create an app bundle first when develop lightning component ?
No it is not necessary to create an Appp Bundle first to develop the lightning component

32. How can we deploy components to production org?


Lightning component can be deployed to the production via change sets, force.com IDE, Managed Package.

33. What is Lightning Experience?


It is the new user Interface developed by salesforce team, which is built on component based framework and event
driven architecture, which provides a dynamic and responsive Experience to the user. This framework is built to
provide optimum performance by using stateful Client side and stateless Server architecture

34. What is the use of implements in lightning component?


Implements is use to refer platform interfaces which enables a component to be used in different contexts or to grant
access to extra context data, a component can implement more than one interfaces.

35. What is aura:registerevent in lightning component?


aura:registerevent is the notifier component and it declares that it may fire a particular event, it includes ‘name’
attribute which is relevant only to component event and is not used for application event. Other attribute is the ‘type’
which lets the component know which event would be fired.

Ex. <aura:registerEvent name=”Event” type=”c:EventName”/>


36. How can we subscribe to an event in lightning component?
To subscribe to an event in lightning component we need to include tag in the containment hierarchy. Subscription of
these event depends on the event type i.e. component event or application event. For Component event we write
below code.

 
In this ‘name’ attribute in should be exactly as name attribute in tag in the component which has fired the component.
The ‘action’ attribute of sets the client-side controller action to handle the event. The ‘event’ attribute specifies the
event being handled.
For Handling Application event we write below code
‘Event’ and ‘action’ attribute are same as the component event handling, it is just that we do not include ‘name’
attribute to handle the application event.

37. How can we communicate between two component?


In Lightning Component Framework, the communication between two component is accompalished supported in
several ways.
1. Attributes or Methods to pass data down the component hierarchy
2. Lightning Events to pass data up and around in the component hierarchy
38. What is aura definition bundle?
It represents a Lightning definition bundle, it contains a Lightning definition and all its related resources. It could define
a component, application, event, interface, or a tokens collection.

An AuraDefinitionBundle component is a collection of component definition files, each representing a different


resource such as markup code, event documentations, applications and interfaces.

Lightning bundles must be under a top-level folder that’s named aura. Each bundle must have its own subfolder under
the aura folder.

A bundle doesn’t have a suffix but definition files can have one of these suffixes
Suffix Component Type
Suffix Component Type

.app Application

.cmp Component

.design Design

.evt Event

.intf Interface

.js Controller, Helper, or Renderer

.svg SVG image

.css Style

.auradoc Documentation

.tokens Tokens collection


39. What is aura:attribute?
They are same as member variable in apex classes, they are typed fields and are instance of a component. Attribute
helps in making component more dynamic.

All attributes have a name and a type can be marked required by specifying ‘required=true’and can also have a default
value. It has a naming rule as well:

1. Must begin with a letter or an underscore


2. Must contain only alphanumeric or underscore characters
40. What is lightning: or ui: in any lightning component?
Lightning has provided us with common User Interface components in the ui namespace which are used in the
lightning component framework. They are ui:input and ui:output provide easy to implement common user interface.
Component with lightning namespace also provides us with the user interface but on top of that they include lightning
design system CSS by default so we do not have to worry about the styling of these components.
41. How can we extend any component?
To make a component extendable we need to set value of ‘extensible’ attribute as ‘true’ of the aura:component tag.
When a component extends another component it inherits all of the helper methods and attributes
42. How to register, fire and handle a component and application event?
We register an event by by using the following code
<aura:registerEvent name=”sampleComponentEvent” type=”c:compEvent”/>
We fire event as shown below:

var compEvent = cmp.getEvent(“sampleComponentEvent”);

compEvent.fire();

Handle component event as below :

<aura:handler name=”sampleComponentEvent” event=”ns:eventName”

    action=”{!c.handleComponentEvent}” phase=”capture” />

Handle Application event as below:

<aura:handler event=”c:appEvent” action=”{!c.handleApplicationEvent}”/>

43. Let’s say that you have an app myApp.app that contains a component myCmp.cmp with a ui:button
component. During initialization, the init() event is fired in what order?
ui:button, ui:myCmp, and myApp.app.

44. Why do we use @AuraEnabled annotation?


The AuraEnabled annotation provides support for Apex methods and properties to be used with the Lightning
Component framework.
The AuraEnabled annotation is overloaded, and is used for two separate and distinct purposes.
1. Use @AuraEnabled on Apex class static methods to make them accessible as remote controller actions in your
Lightning components.
2. Use @AuraEnabled on Apex instance methods and properties to make them serializable when an instance of the
class is returned as data from a server-side action.
45. Why do we use $A.enqueueAction(action)?
It adds the server-side controller action to the queue of actions to be executed. Rather than sending a separate
request for each individual action, the framework processes the event chain and batches the actions in the queue into
one request. The actions are asynchronous and have callbacks.

46. Use of THIS CSS class?


This adds namespacing to CSS and helps prevent one component’s CSS from blowing away another component’s
styling.

47. What are the different ways to conditionally display markup, and what is the preferred approach?
Using the <aura:if> tag
Use CSS to toggle visibility of markup by calling $A.util.toggleClass(cmp, ‘class’) in JavaScript code.
47. What is $Resource global value provider? Is it possible to obtain a reference to a static resource in
Javascript code?
It lets you reference images, style sheets, and JavaScript code you’ve uploaded in static resources.

To obtain a reference to a static resource in JavaScript code, use $A.get(‘$Resource.resourceName’).

48. Let’s say you have several buttons that reuse the same onclick handler. How will you retrieve the name of
the button that fired the event?
Use event.getSource() in the client-side controller to get the button component that was clicked. Call

getLocalId() to get the aura:id of the clicked button.

49. What are the names of interfaces that are added to a Lightning component to allow it to be used as
custom tabs, and to be used in Lightning and Community builder?
‘force:appHostable’ Allows a component to be used as a custom tab in Lightning Experience or the Salesforce app
‘forceCommunity:availableForAllPageTypes’ To appear in Community Builder, a component must implement the
forceCommunity:availableForAllPageTypes interface
50. What is the use of force:hasRecordId interface?
Add the force:hasRecordId interface to a Lightning component to enable the component to be assigned the ID of the
current record.
The recordId attribute is set only when you place or invoke the component in a context of a record. For example, when
you place the component on a record page, or invoke it as an action from a record page or object home. In all other
cases, such as when you create this component programmatically inside another component, recordId isn’t set, and
your component shouldn’t depend on it.
51. What is Lightning Design System (SLDS)?
The Salesforce Lightning Design System (SLDS) component library is actively developed to enable Salesforce
developers to create a uniform look and feel across all Salesforce-related applications while adhering to CSS best
practices and conventions.

52. What is the use of access=“global”?


The framework enables you to control access to your applications, attributes, components, events, interfaces, and
methods via the access system attribute. The access system attribute indicates whether the resource can be used
outside of its own namespace.
You can specify these values for the access system attribute.
Private: Available within the component, app, interface, event, or method and can’t be referenced outside the
resource. This value can only be used for or .Marking an attribute as private makes it easier to refactor the attribute in
the future as the attribute can only be used within the resource.
Accessing a private attribute returns undefined unless you reference it from the component in which it’s declared. You
can’t access a private attribute from a sub-component that extends the component containing the private attribute.
Public: Available within your org only. This is the default access value.

Global: Available in all orgs.

53. What is Lightning Data Services?


They are similar to a standard controller in Apex coding, advantages of using lightning Data service are mentioned
below
1. Use Lightning Data Service to load, create, edit, or delete a record in your component without requiring Apex code.
2. Lightning Data Service handles sharing rules and field-level security for you.
3. In addition to not needing Apex, Lightning Data Service improves performance and user interface consistency.
54. What are Local and Global ids with respect to lightning component?
Component IDs
A component has two types of IDs: a local ID and a global ID. You can retrieve a component using its local ID in your
JavaScript code. A global ID can be useful to differentiate between multiple instances of a component or for
debugging purposes.
Local IDs
A local ID is an ID that is only scoped to the component. A local ID is often unique but it’s not required to be unique.
Create a local ID by using the aura:id attribute. For example:
Find the button component by calling cmp.find(“button1”) in your client-side controller, where cmp is a reference to the
component containing the button.
Global IDs
Every component has a unique globalId, which is the generated runtime-unique ID of the component instance. A
global ID (1) is not guaranteed to be the same beyond the lifetime of a component, so it should never be relied on. A
global ID can be useful to differentiate between multiple instances of a component or for debugging purposes.
55. What is a FlexiPage in lightning?

FlexiPage
Represents the metadata associated with a Lightning page. A Lightning page represents a customizable screen made
up of regions containing Lightning components.
A Lightning page region can contain upto 25 components.
Lightning pages are referred as FlexiPages in API and referred as Lightning pages elsewhere in SFDC documentation

56. How to make quick lightning action?


Add the force:lightningQuickAction or force:lightningQuickActionWithoutHeader interface to a Lightning component to
enable it to be used as a custom action in Lightning Experience or the Salesforce mobile app. You can use
components that implement one of these interfaces as object-specific or global actions in both Lightning Experience
and the Salesforce app.

57. What are value providers in Salesforce Lightning ?


Value providers helps use to access data in Lightning Application .They are two value providers as v(View) and
c(controller)
v is component attribute set which helps to access component attribute values in markup
c is component controller helps us to link with event handlers and action for the component
58. List of Global value providers?
$globalID
$Browser
$Label
$Locale
$Resource
59. What are list of tools are avaliable in salesforce lightning ?
Lightning Connect
Lightning Component Framework
Lightning Schema Builder
Lightning Process Builder
Lightning App Builder
The answer to the questions have been referred from https://developer.salesforce.com and are reiterated in my
language. Please go to the community to better understand the concept and enhance your knowledge, meanwhile use
this post a help during your interview.
Keep learning.

Q1). What is Lightning?


Lightning refers to a set of tools and technologies which are behind a prominent upgrade to
the Salesforce platform.

Read: What Apex Email in Salesforce?

It has the following components:


 Experience: It refers to a group of modern user interfaces which are optimized for
speed. This involves Lightning Experience, Salesforce 1 Mobile App, and other
template-based communities.
 Lightning Component Framework: It is a JavaScript framework and a group of
standard components which let you build reusable components for customization of
Lightning Experience, Salesforce 1Mobile app, and template-based communities.
 Visual Building Tools: It refers to the drag-and-drop technologies for quick and simple
app building and customization. Lightning App Builder is used for customization of
Lightning Experience and Salesforce 1 Mobile app. Community builder is used for
customization of template-based communities.
 Lightning Exchange: This refers to a section of AppExchange where nearly more than
70 partner components are found for jump-starting the development.
 Lightning Design System: It refers to the style guides and best practices of modern
enterprise UX for building pixel-perfect apps which match the look and appeal of the
Lightning Experience and Salesforce 1Mobile app.

Q2). How can Lightning Components be used with the Salesforce 1Mobile App?
Lightning components can be used with Salesforce 1Mobile App by creating a custom
Lightning tab which points to our component and includes that tab in our Salesforce 1 Mobile
navigation.

Q3). Can a Lightning Component which shows up in both the Mobile and the
Desktop User Interfaces be made?
Lightning Components can be directly used in Lightning Experience, the Salesforce 1 Mobile
app, template-based communities, and other standalone apps. Additionally, it also includes
Lightning components in a Visualforce page, which allows us to use them in Salesforce
Classic, Visualforce-based communities and Console.

Q4). Do you think Lightning is an Mvc Framework?


Lightning is a component-based framework.

Q5). Which parts of the Lightning Components are server-side and which are on
client-side?
Lightning components make use of JavaScript on the client-side and Apex on the server-side.

Q6). What is the type of different events into Salesforce Lightning Component?
Application Event: The event has a scope which is throughout the lightning App, and any
component which has registered for this event gets a notification.

System Event: These are the events which are fired by the Salesforce system during the
lifecycle of the app.

Component Event: Scope of this falls within the parent component of this event. All the
components declared by the parent will also get notified of this event.
Q7). What is the difference between the component event and the application
event?
Component Events: these are used to when the parent and child need to communicate. They
make use of bubbling and capture, just like it is used in DOM events. A change in a child
component will be communicated to the parent component through the component event.

Application Events: these are basically used for communicating any kind of change in the
component to a larger audience. Any component which has been registered for this event will
get notified.

Q8). When should component events and application events be used?


It is always a good idea to use a component event over an application event. Component
events can be handled only by the components which are above them in the hierarchy of
containment. Thus, the usage is limited to the components which need to know them.

Application events are best used when something is handled at the application level, like
navigating to a particular record. Application events permit any communication between the
components which are in separate parts of the application and have no direct containment
relationship.

Read: Salesforce CRM vs. SAP CRM- Which One is Better?

Q9). Which interface is often used for implementation so that a lightning


component can be used for quick action?
Implementation can be done following the “force: lightningQuickAction” so that the component
can be used for quick action.

Q10). Which interface is often used for implementation so that a lightning


component can be used as a Tab?
The lightning component can be used as a Tab by following “force: apps stable.”

Q11). How can a Lightning component be used in a Visualforce page?


A Lightning Component can be embedded in any kind of webpage by a highly powerful and
flexible feature called the Lightning out. In Visualforce, some level of complexity comes down.
Lightning Component can be used in the Visualforce page in three steps:

 Add the Lightning Components for Visualforce JavaScript library for the targeted page
of Visualforce using the tag.
 Next, a Lightning app has to be created and referred to in component dependencies.
 Finally, a JavaScript Function needs to be written which will ultimately create the
component on the page by making use of $Lightning.createComponentt() 
Q12). Name a few different Lightning Component bundles?

13). How can FLS be ensured while working on the Lightning Component?


FLS and CRUD have to be manually enforced in the Apex Controlle, or it can be done using
the Lightning Data service wherever possible as it handles both the FLS and CRUD. Both of
them are not enforced automatically in case any object is referenced in the Apex Controller.

Q14). How can Lightning Components be used in the Salesforce1 Mobile App?
A lightning tab has to be made, which is aimed at the lightning component which has been
created. The tab then has to be included in the salesforce1 Mobile Navigation select list and
the newly created tab for it.

Q15). Is it possible to make a Lightning Component that shows up in the mobile


and the desktop user interfaces?
Lightning Component refers to a lightning experience which is ready by default and also has
compatibility in Salesforce1 App. The layout is responsive and thus adjusts as per the
resolution of the screen size. Hence, it cannot be used in desktop and without any separate
code.
Q16). What is the limit on the number of components which can be included in
one Application?
The number of components which can be defined in an application in Salesforce has no upper
limit.

Q17). What do you mean by Aura?


Aura is basically a User Interface framework which is used in the development of dynamic web
apps for both the mobile and desktop devices. Aura gives scalable long-lived lifecycle support
to the building of apps which are engineered for growth. Aura backs the partitioned multi-tier
component development which bridges client and the server. JavaScript is used on the client-
side while Java is used on the server-side.

Q18). Do you think a namespace is used for the development of Lightning


Components?
A namespace is not essential for the development of a lightning component.

Q19). What is the underlying difference between Visualforce Component and the
Lightning Component?
Visualforce page is created by keeping it at the center of the application, and most of its
calculation is taken up at the server-side. The lightning component, on the other hand, is
created by making use of the component-based framework, and most of the calculations are
performed at the side of the client. It gives a more dynamic and rich customer experience. The
lightning component is built using the mobile-first approach.

Q20). Are there any CSS styles provided by the Salesforce.com which support
the Lightning components?
Salesforce has given the lightning design system as the default CSS which can be used with
the Lightning component.

Q21). Do you think Lightning Components are only directed towards mobile
apps?
Lightning Components are designed with a mobile-first approach, but the responsive design
allows it to give the same experience even over the desktop without the need for writing any
separate lines of code.

Read: Zoho vs. Salesforce - CRM Software Comparison for Small Business

Q22). Mention any advantages of lightning?


Lightning has many advantages like an extraordinary component set which lets fast creation of
new apps, easy decoupling between the components can be enabled by the event-driven
architecture. Also, it is endowed with device awareness, cross-browser compatibility, and an
optimized framework for performance.
Q23). Is it possible to integrate Lightning components with another framework
like Angular?
Yes, Lightning components can be integrated with any third-party framework like Angular.

Q24). Where can the lightning component be displayed?


The lightning component can be displayed in the following places:

Q25). How can components be deployed to the production org?


Lightning components can be deployed to the production by change sets, force.com, IDE, and
Managed Package.

Q26). What is the meaning of Lightning Experience?


Lightning Experience refers to the new User Interface, which is developed by the Salesforce
team and is built on a component-based framework and architecture driven by events which
provide a highly dynamic and responsive experience to the user. This framework is so
designed to give optimum performance by the Client side and the stateless Server
architecture.
Q27). What is the use of implements in the lightning component?
Implements are basically used for referring to various interfaces of the platform which enable a
component for use in different contexts or granting access to extra context data. A component
can often implement multiple interfaces.

Q28). How can we subscribe to an event in Lightning component?


For subscribing to any event in Lightning component, tags have to be included in the
containment hierarchy. Subscription of this event is dependent on the type of event, i.e.
component event or application event.

Q29). How can we communicate between two different components?


In a Lightning Component Framework, the communication between two components can be
accomplished in the following ways:

 Attributes which pass data down the component hierarchy


 Lightning Events which pass data up and around the hierarchy of the components 

Q30). What is aura: attribute?


They are like member variables in apex classes, are typed fields and instance of a component.
All attributes have been assigned a name and a type which can be marked required by
specifying ‘required=true’ and also has a default value. It has a naming rule.

 It should begin with a letter and an underscore.


 Mostly they contain only alphanumeric or underscore characters.

Conclusion

Salesforce Lightning is basically designed to simplify processes for various business users
who typically do not have any kind of programming experience. It has a huge scope, and thus,
the interview preparation needs to be done with a lot of care and seriousness. There are many
aspects which have to be touched. The questions mentioned above if done properly will
definitely give you an edge over other participants. The only part of an interview is the
preparation, which is in your control. As it is said, control the controllable so you should put in
all the efforts to make sure that there is nothing left undone in your preparation and you enter
the interview room loaded with confidence.

Salesforce Lightning Interview Questions


In this post I am going to share Salesforce Lightning Interview Questions

Here is list of all Salesforce Lightning Interview Questions:

 What is Salesforce Lightning?


 What are the tools included in lightning ?
 What is Aura? Why do I see the aura: namespace in the code?
 Is Lightning an MVC framework?
 What is difference between Visualforce Components and Lightning Components?
 Where we can display lightning component?
 What are the different Lightning component bundles?
 What is Lightning Experience?
 What is Lightning Design System?
 What happens to my existing Visualforce Pages?
 What are the type of events into Salesforce Lightning component?
 What is the basic difference between Application Event and Component Event?
 Component events vs Application events. Which one I should use?
 What is aura definition bundle?
 What is the use of implements in lightning component?
 Which interface we are supposed to implement so that a lightning component can be used as a
Tab?
 Which interface we are supposed to implement so that a lightning component can be used as quick
action?
 Which interface we are supposed to implement so that a lightning component can be used in
Community builder?
 What is use of @AuraEnabled annotation
 Can we Include One Lightning component to another ?
 How can we use Lightning Components with the Salesforce1 Mobile App ?
 How can we use a lightning component in a VisualForce Page?
 Can we integrate Lightning components with another framework like Angular?
 Can we include external JavaScript/CSS libraries like jQuery, bootstrap in components?
 What is use of aura:method tag in salesforce lightning?
 How to ensure FLS while working with Lightning Component?
 How can we display loading spinner in lightning component?
 How can we conditionally display content in lightning component?
 What is the use of force:hasRecordId interface?
 How to get current record id in lightning component?
 What is a FlexiPage in lightning?
 How can we deploy lightning components?
 What Is Lightning Data Service?
 What is Locker Service in Salesforce Lightning?
 What are value providers in Salesforce Lightning ?
 What are List of Global value providers in lightning?
 How to create popup in lightning component?
 

Here is list of all Salesforce lightning interview questions and answers:

What is Salesforce Lightning?


Lightning is the collection of tools and technologies behind a significant upgrade to the Salesforce
platform. Lightning includes:
 Experience: A set of modern user interfaces optimized for speed. This includes the Lightning
Experience, Salesforce1 Mobile app and template-based communities.
 Lightning Component Framework: A JavaScript framework and set of standard components that
allow you to build reusable components to customize the Lightning Experience, Salesforce1 Mobile app
and template-based communities and build your own standalone apps.
 Visual Building Tools: Drag-and-drop technologies for fast and easy app building & customizations.
Use the Lightning App Builder to customize the Lightning Experience and Salesforce1 Mobile app. Use the
Community Builder to customize template-based communities.
 Lightning Exchange: A section of the AppExchange where you can find 70+ partner components to
jumpstart your development.
 Lightning Design System: Style guides and modern enterprise UX best practices to build pixel
perfect apps that match the look and feel of the Lightning Experience and Salesforce1 Mobile app.

Salesforce Lightning Interview Questions

What are the tools included in lightning ?


 Lightning Component Framework – Components and extensions that allow you to build reusable
components, customize the Salesforce1 Mobile App, and build standalone apps.
 Lightning App Builder – A new UI tool that lets you build apps lightning fast, using components
provided by Salesforce and platform developers.
 Lightning Connect – An integration tool that makes it easier for your Force.com app to consume
data from any external source that conforms to the OData spec.
 Lightning Process Builder – A UI tool for visualizing and creating automated business processes.
 Lightning Schema Builder – A UI tool for viewing and creating objects, fields, and relationships.

What is Aura? Why do I see the aura: namespace in the code?


Aura is the open source technology that powers Lightning Components. The aura: namespace
contains all of the basic building blocks for defining components and applications.

Is Lightning an MVC framework?


No, it’s a component-based framework.

What is difference between Visualforce Components and


Lightning Components?
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.

Where we can display lightning component?


There are a number of possibilities for display lightning component..

  Lightning Experience: We can display component in the Lightning Experience using the App
Builder. We can edit the home page, edit a record detail page or create/edit a new app page to include it.
  Salesforce1 Mobile app: We can display component in the Salesforce1 Mobile app by creating a
custom Lightning tab that references it and adding that tab in mobile navigation.
 Standalone Lightning app: By create a standalone Lightning app (e.g. myapp.app) and include
component in this app. Access Lightning app by URL.
 Add Apps to the Lightning Experience App Launcher: Your Lightning Components apps and custom
tabs are available from the App Launcher.
 Add Apps to Lightning Experience and Salesforce App Navigation:  You can add Lightning
components tabs to an app and they display as items in the app’s navigation bar.
 Lightning App Builder and Community Builder : We can display component in template-based (e.g.
Napili) community using the Community Builder. Build custom user interfaces using your own Lightning
components, or those you install from AppExchange, for desktop and mobile devices.
 Add Lightning Components to Lightning Pages: A Lightning Page is a custom layout that lets you
design pages for use in the Salesforce mobile app or in Lightning Experience. You can use a Lightning
Page to create an app home page and add your favorite Lightning component, such as the Expenses app
we’ll be creating in this module, to it.
 Add Lightning Components to Lightning Experience Record Pages: You can customize Lightning
Experience record pages by adding a Lightning Component.
 Launch a Lightning Component as a Quick Action: Create actions using a Lightning component, and
then add the action to an object’s page layout to make it instantly accessible from a record page.
 Create Stand-Alone Apps: A standalone app comprises components that use your Salesforce data
and can be used independently from the standard Salesforce environment.
 Run Lightning Components Apps Inside Visualforce Pages: Add Lightning components to your
Visualforce pages to combine features you’ve built using both solutions. Implement new functionality using
Lightning components and then use it with existing Visualforce pages.
 Run Lightning Components Apps on Other Platforms with Lightning Out: Lightning Out is a feature
that extends Lightning apps. It acts as a bridge to surface Lightning components in any remote web
container. This means you can use your Lightning components inside of an external site (for example,
Sharepoint or SAP), or even elsewhere on the platform such as on Heroku.
 Customize Flow Screens: Create a flow to guide your users through a business process. By default,
you can add simple fields like inputs or radio buttons to a flow screen. But with a custom Lightning
component, you can fully customize the look-and-feel and functionality of your screen.

What are the different Lightning component bundles?


 Component :UI for lightning component
 Controller: Contains client-side controller methods to handle events in the component.
 Helper: JavaScript functions that can be called from any JavaScript code in a component’s bundle
 Style: Contains styles for the component.
 Document: A description, sample code, and one or multiple references to example components
 Design: File required for components used in Lightning App Builder, Lightning pages, or Community
Builder.
 SVG: Custom icon resource for components used in the Lightning App Builder or Community
Builder.
 Renderer: Client-side renderer to override default rendering for a component.
Click Here for official Salesforce documentation.

What is Lightning Experience?


Lightning Experience is the name for the all new Salesforce desktop app, with new features, built
with a modern user interface and optimized for speed.

What is Lightning Design System?


Style guides and modern enterprise UX best practices to build pixel perfect apps that match the
look and feel of the Lightning Experience and Salesforce1 Mobile app. Click Here for official link.

What happens to my existing Visualforce Pages?


They’ll continue to be supported in the current UI and Lightning Experience. See the Trailhead
module on this topic.

What are the type of events into Salesforce Lightning


component?
 Application Event – Scope of this event is throughout the lightning App and any component which
has registered for this event would get a notification.
 Component Event– Scope of this event is within itself or the parent component of this event, all the
components declared within the parent component would get notified of this event.
 System Event- these are the events fired by Salesforce’s system during the lifecycle of the lightning
app.
 

What is the basic difference between Application Event and


Component Event?
Component events are used to do communication between child and parent. They use bubbling
and capture same as used in DOM events. A change in a child component can be communicated
to the parent component via component event.

Application events are used to communicate any change in the component to a broader audience.
Any component who has registered for this event will get a notified.

Component events vs Application events. Which one I should


use?
Component events can only be handled by components above them in the containment hierarchy,
therefore, their usage is localized to the components that need to know about them.

Application events are best used for something that should be handled at the application level,
such as navigating to a specific record. Application events allow communication between
components that are in separate parts of the application and have no direct containment
relationship.

What is aura definition bundle?


A bundle contains an Aura definition and its related resources. The definition can be a component,
application, event, interface, or a tokens collection.

An AuraDefinitionBundle component is a folder that contains definition files. Unlike most other
metadata components, an AuraDefinitionBundle component isn’t a single file, it’s a collection of
files. Each file represents a resource in a bundle, such as markup, applications, code files
(including controllers and helpers), events, documentation, and interfaces.

A bundle doesn’t have a suffix. Definition files can have one of these suffixes:

Suffix Component Type

.app Application

.cmp Component

.design Design

.evt Event
Suffix Component Type

.intf Interface

.js Controller, Helper, or Renderer

.svg SVG Image

.css Style

.auradoc Documentation

.tokens Tokens collection

What is the use of implements in lightning component?


Implements is use to refer platform interfaces which enables a component to be used in different
contexts or to grant access to extra context data, a component can implement more than one
interfaces.

Here is list of all interfaces that can be implemented in lightning component

Which interface we are supposed to implement so that a lightning


component can be used as a Tab?
We need to implement the following “force:appHostable” so that we can use the component as a
Tab.

Which interface we are supposed to implement so that a lightning


component can be used as quick action?
We need to implement the following “force: lightningQuickAction” so that we can use the
component as a Quick Action.

Which interface we are supposed to implement so that a lightning


component can be used in Community builder?
We need to implement the following “forceCommunity:availableForAllPageTypes” so that we can
use the component in community builder.
What is use of @AuraEnabled annotation
How to call apex class from lightning component
The AuraEnabled annotation enables Lightning components to access Apex methods and properties.

The AuraEnabled annotation is overloaded, and is used for two separate and distinct purposes.

 Use @AuraEnabled on Apex class static methods to make them accessible as remote


controller actions in your Lightning components.
 Use @AuraEnabled on Apex instance methods and properties to make them serializable
when an instance of the class is returned as data from a server-side action.
For more details, please refer to lightning:datatable example

Can we Include One Lightning component to another ?


Yes we can include one Lightning component inside another Lightning component

How can we use Lightning Components with the Salesforce1


Mobile App ?
We can create a custom Lightning tab that points to our component and include that tab in our
Salesforce1 Mobile navigation.

How can we use a lightning component in a VisualForce Page?


A Lightning component can be embed in any webpage using a very powerful and flexible feature,
Lighting out. When used with Visualforce some complexity becomes simpler.
Lightning component can be added to Visualforce page in three steps:

1. We have to first Add the Lightning Components for Visualforce JavaScript library to your targetted
Visualforce page using the tag.
2. Next we have to create and refer a Lightning app which is used to the component dependencies.
3. Lastly we need to write a JavaScript function which will finally create the the component on the page
using $Lightning.createComponent()
For more details, please refer Use Lightning Components in Visualforce Pages

Can we integrate Lightning components with another framework


like Angular?
Yes, we can integrate lightning with any 3rd party framework.

Can we include external JavaScript/CSS libraries like jQuery,


bootstrap in components?
Yes, we can use multiple libraries in our lightning component like JQuery, Bootstrap, custom CSS
and custom Javascript libraries using static resource.
What is use of aura:method tag in salesforce lightning?
We can use <aura:method> to define a method as part of a component’s API. This enables you
to directly call a method in a component’s client-side controller instead of firing and handling a
component event. Using <aura:method> simplifies the code needed for a parent component to
call a method on a child component that it contains.

How to ensure FLS while working with Lightning Component?


FLS and CRUD are not automatically enforced in the lightning component whenever any object is
referenced in the Apex Controller and the component will display the fields and records for which
the users do not have access. Therefore we should manually enforce the FLS and CRUD in the
Apex Controller. Also when we use Lightning Data service  it takes care of FLS and CRUD for us.

How can we display loading spinner in lightning component?


Spinners are CSS loading indicators that should be shown when retrieving data or performing slow
computations. lightning:spinner displays an animated spinner image to indicate that a request is
loading. This component can be used when retrieving data or performing an operation that takes
time to complete.

aura:waiting and aura:donewaiting can be used for controlling the loading spinner.

For more details please refer to below post lightning spinner

How can we conditionally display content in lightning component?


We can use aura:if to conditionally display content in lightning component. For more details refer
to below post aura:if in lightning component

What is the use of force:hasRecordId interface?


or

How to get current record id in lightning component?


Add the force:hasRecordId interface to a Lightning component to enable the component to be
assigned the ID of the current record. The current record ID is useful if the component is used on a
Lightning record page, as an object-specific custom action or action override in Lightning
Experience or the Salesforce app, and so on. This interface has no effect except when used within
Lightning Experience, the Salesforce mobile app, and template-based communities.

For more details refer below link force:hasRecordId

What is a FlexiPage in lightning?


FlexiPage represents the metadata associated with a Lightning page. A Lightning page
represents a customizable screen made up of regions containing Lightning components.
A Lightning page can contain upto 25 components. Flexi page are stored as xml file and can be
deployed using metadata api or any deployment tool.
Lightning pages are referred as FlexiPages in API and referred as Lightning pages elsewhere in
SFDC documentation.

How can we deploy lightning components?


Lightning components can be deployed similar to any other component using changeset, ant
migration tool, eclipse or any other migration tool.

What Is Lightning Data Service?


Use Lightning Data Service to load, create, edit, or delete a record in your component without
requiring Apex code. Lightning Data Service handles sharing rules and field-level security for you.
In addition to not needing Apex, Lightning Data Service improves performance and user interface
consistency. Main advantage of using lightning data service is that we can perform basic
operations without Apex code.

For more details refer to below link Lightning Data Service

What is Locker Service in Salesforce Lightning?


Locker Service is a powerful security architecture for Lightning components. Locker Service
enhances security by isolating Lightning components that belong to one namespace from
components in a different namespace. Locker Service also promotes best practices that improve
the supportability of your code by only allowing access to supported APIs and eliminating access
to non-published framework internals.

For more details please refer below link: Locker Services

What are value providers in Salesforce Lightning ?


Value Providers in lightning Component encapsulate related values together and used to access
data. In Salesforce lightning, we have two value providers for a component they are v (View) and c
(Controller).

 v is component attribute set which helps to access component attribute values in markup
 c is component controller helps us to link with event handlers and action for the component

What are List of Global value providers in lightning?


 $globalID
 $Browser
 $Label
 $Locale
 $Resource
 
How to create popup in lightning component?
Modals/Popup Box are used to display content in a layer above the app. This paradigm is used in
cases such as the creation or editing of a record, as well as various types of messaging and
wizards.

You might also like