Salesforce Lightning Interview Questions
Q1) What is Lightning?
Lightning refers to a set of tools and technologies which are behind a prominent
upgrade to the Salesforce platform.
It has the following components:
© Experience: It refers to a group of modem user interfaces which are
optimized for speed. This involves Lightning Experience, Salesforce1 Mobile
App, and other template-based communities.
* Lightning Component Framework: It is a JavaScript framework and a group
of standard components that let you build reusable components for
customization of Lightning Experience, Salesforce1 Mobile 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 Salesforce1 Mobile app.
Community builders are 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 Salesforce1 Mobile app.
Q2). How can Lightning Components be used with the Salesforce1 Mobile App?
Lightning components can be used with Salesforcel Mobile App by creating a
custom Lightning tab which points to our component and includes that tab in our
Salesforce Mobile navigation.
Q3), Can a Lightning Component which shows up in both the Mobile and the
Desktop User Interfaces be made?
RUPOM CHAKRABORTY - Capital Info Solutions
‘Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286Lightning Components can be directly used in Lightning Experience, the
Salesforce1 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 that is throughout the lightning App.
and any component which has registered for this event gets a notification.
System Event: These are the events that are fired by the Salesforce system during
the lifecycle of the app.
Component Event: The 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 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?
RUPOM CHAKRABORTY - Capital Info Solutions
‘Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286It 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.
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?
a. Component
b. Controller
c. Helper
d, Style
RUPOM CHAKRABORTY - Capital Info Solutions
‘Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286e. Document
f. Design
g. SVG
h. Rendrer
Q13) 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.
Q14) 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.
Q15) 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 Salesforce 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.
Q16) Is Lightning component framework an MVC framework ?
No it is not a MVC framework it is a component based framework and event
driven.
Q17) 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.
RUPOM CHAKRABORTY - Capital Info Solutions
‘Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286Q18) 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
Q19) 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
Q20) Can we Include One Lightning component to another ?
Yes we can include one Lightning component in another Lightning component
Q21) 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
Q22) Is Lightning Components replacing Visualforce?
No Lightning component is not replacing Visualforce, Visualforce is still supported
by Salesforce.
Q23) 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.
Q24) 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.
Q25) 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
RUPOM CHAKRABORTY - Capital Info Solutions
‘Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286reusable 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 -
relationship among them,
is a visualizing tool to view, create objects fields and
Q26) 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.
Q27) Does Lightning work with Visualforce ?
Yes Lightning component works with Visualforce by implementing Lightning out
as discussed earlier.
Q28) 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.
Q29) 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
Q30) 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.
RUPOM CHAKRABORTY - Capital Info Solutions
‘Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286Q31) Can we integrate Lightning components with another framework, such as
Angular?
Yes we can integrate lightning with any 3rd party framework.
Q32) Can we include external JavaScript/Css libraries in components?
It is possible to use custom CSS and JAvascriipt in the Lightning component
Q33) 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
Q34) 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 }
Q35) Do | 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
Q36) How can we deploy components to production org?
Lightning component can be deployed to the production via change sets,
force.com IDE, Managed Package.
Q37) 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
Q38) What is the use of implements in lightning component?
RUPOM CHAKRABORTY - Capital Info Solutions
‘Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286Implements 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.
Q39) 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,
Q40) 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
ie. 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.
Q41) 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
42) 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.
RUPOM CHAKRABORTY - Capital Info Solutions
‘Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286An AuraDefinitionBundle components 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
scmp Component
design Design
evt Event
.intf Interface
‘is Controller, Helper, or Renderer
svg SVG image
css Style
We fire event as shown below:
var compEvent = cmp.getEvent(“sampleComponentEvent”);
compEvent.fire();
Handle component event as below :
Handle Application event as below:
Q47) 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?
uizbutton, ui:myCmp, and myApp.app.
Q48) 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.
RUPOM CHAKRABORTY - Capital Info Solutions
‘Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286