Javatpoint Logo
Javatpoint Logo

Top 45+ Most Asked Salesforce Lightning Interview Questions and Answers

1) What is Salesforce Lightning?

Salesforce Lightning is a component-based framework developed by to provide app development. It is designed to simplify business users who are not aware of this technology and typically do not have programming experience.

Salesforce Lightning consists of a set of tools and technologies behind an important upgrade to the Salesforce1 Platform (now known as App Cloud), the company's mobile app development platform.

2) What are the most important features of Salesforce Lightning? / What are the most important components that Salesforce Lightning contains?

Salesforce Lightning contains the following important components:

Experience: It is a set of modern user interfaces optimized for speed. This includes the Lightning Experience, Salesforce1 Mobile App, and template-based communities.

Lightning Component Framework: This is a JavaScript framework and set of standard components that facilitate us to build reusable components to customize the Lightning Experience, Salesforce1 Mobile App, and template-based communities and build your standalone apps.

Lightning Exchange: It specifies a section of the AppExchange where we can find 70+ partner components to start our development.

Lightning Design System: It specifies the best practices and 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.

Visual Building Tools: It specifies the drag-and-drop technologies for fast and easy app building & customizations. We can use the Lightning App Builder to customize the Lightning Experience and Salesforce1 Mobile app. We can also use the Community Builder to customize template-based communities.

3) How can we develop Salesforce Lightning components?

We can develop the Salesforce Lightning components by using the following two programming models:

  • Native Aura Components model
  • Lightning web components model

4) Is Salesforce Lightning an MVC framework?

No, Salesforce Lightning is not an MVC framework. Instead, it is a component-based framework.

5) What do you understand by Lightning experience?

Lightning experience is the latest Salesforce desktop application, which has the latest features. Lightning experience is developed with an advanced User Interface (UI) and provides a lightning-fast optimized speed.

6) What are the important tools included in Lightning?

Following is the list of main tools included in Lightning:

Lightning Component Framework: The set of components and extensions facilitates us to build reusable components, customize the Salesforce1 Mobile App, and build standalone apps.

Lightning App Builder: It is a new UI tool that facilitates us to build extremely fast apps using components provided by Salesforce and platform developers.

Lightning Process Builder: This is a UI tool for visualizing and creating automated business processes.

Lightning Schema Builder: This is also a UI tool used for viewing and creating objects, fields, and relationships.

Lightning Connect: This is an integration tool that makes the app easily consume data from any external source that conforms to the OData spec.

7) What is Aura? What is the use of aura: namespace?

Aura is an open-source freeware technology that powers Lightning Components. The aura: namespace consists of all basic building blocks to define applications and components.

8) What do you understand about the Aura application bundle?

The Aura application bundle consists of definitions and their associated resources. The aura definition can be defined as an application, interface, component, and event. The Aura definition bundle element is a folder consisting of definition files opposite the other metadata components. On the other hand, the aura definition bundle component is not a single file. Instead, it is a group of files.

9) What is the difference between Visualforce Components and Lightning Components?

The Visualforce components are page-centric, and they complete most of the work on the server. On the other hand, Lightning Components are client-side centric, making them more dynamic and mobile-friendly.

10) How do the two programming models, the Native Aura Components model, and Lightning web components model, coexist?

The Native Aura Components model and Lightning, web components model, can be coexisted in the following way:

  • The Native Aura Components model can contain and utilize the Lightning web components model, including communicating via events and component methods. But, the opposite is not true. The Lightning web components model cannot be composed of Aura components, and they can only ever be its parent.
  • The code can also be shared between the Aura Components model and Lightning web components model using an ES Module.

11) What are the different types of events of Salesforce lightning components?

Following are the main three different types of events of Salesforce lightning components:

  • System Events: The system events are fired during the lightning app lifecycle.
  • Application Event: The application event is extended across the lightning application, and then any element that has enrolled for this event will get an alert.
  • Component Event: The component event scope is within itself or the parent component of this event. After that, all the parent components will get an alert.

12) What are the different component bundles of the lightning components?

Following is the list of the different component bundles of the lightning components:

  • Component: It specifies the UI for the lightning components.
  • Controller: It contains the client-side controller methods to handle components' events. It is also used to handle client-side events.
  • Style: It consists of the styles for the component.
  • Helper: A JavaScript function can be called from any JavaScript code in a component's bundle. We can write a general logic in the helper and use it later in various controller methods to avoid repetition.
  • Document / Documentation: It specifies the description, sample code, and one or multiple references to example components. This component bundle is used for recording the component's use.
  • Renderer: The renderer component bundle contains a client-side renderer to override default rendering for a component.
  • SVG: It is a custom icon resource for components used in the Lightning App Builder or Community Builder.
  • Design: It consists of the file required for components used in Lightning App Builder, Lightning pages, or Community Builder.

13) What is the use of Lightning Data Service?

Following are the main usages of Lightning Data Service:

  • Lightning Data Service is used for creating, deleting, editing, and loading a record in our component without Apex code.
  • It is used to handle field-level security and sharing rules.
  • It is used to enhance the user interface and performance consistency.
  • The biggest advantage of using Lightning Data Service is that it facilitates us to carry out basic tasks without Apex code.

14) What do you understand about the Lightning Design System?

The Lightning Design System provides style guides and modern enterprise UX best practices to build pixel-perfect apps that look great and provide a look and feel of the Lightning Experience and Salesforce1 Mobile app.

15) What are the different events used in the Salesforce Lightning component?

Following are the different types of events used in the Salesforce Lightning component:

Application Event: The scope of the application event is throughout the lightning App. It sends a notification if any component is registered for this event.

Component Event: The scope of this event is within itself or the parent component of this event. It sends a notification for all the components declared within the parent component.

System Event: This type of event is fired by Salesforce's system during the lifecycle of the lightning app.

16) What do you understand by aura definition bundle?

An aura definition bundle is a specific type of bundle that contains an Aura definition and its related resources. This may be a component, application, event, interface, or a tokens collection. The AuraDefinitionBundle component is a folder that contains definition files. This is not a single file like most other metadata components. Instead, it is a collection of files. Each file represents a resource in a bundle, such as a markup, applications, code files (including controllers and helpers), events, documentation, and interfaces.

An aura definition bundle does not have a suffix. The definition files can have one of the following suffixes:

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

17) What is Lightning out?

Lightning out is a process that is used when we want to use our component on the external site. The biggest advantage of lightning out is utilizing lightning components in a visual force page.

18) What are the key differences between Component Event and Application Event?

Following is the list of key differences between Component Event and Application Event:

Component Event Application Event
Component events are used for communication between child and parent. Application events are used to communicate any changes in the component to a broader audience.
Component events use bubbling and capture same as used in DOM events. If you make any changes in a child component, it will be communicated to the parent component via component event. If a component is registered for this event in application events, it will get notified.
Component events can only be handled by components above them in the containment hierarchy. That's why their usage is localized to the components that need to know about them. Application events are best suitable for things that should be handled at the application level, such as navigating to a specific record. Application events also allow communication between components in separate application parts and have no direct containment relationship.

19) What are the different types of Lightning Record pages, and how can we build them?

There are mainly three types of Lightning Record pages:

  • Record page
  • App page
  • Home page

We can create or build Lightning Record pages by using Lightning App Builder.

20) What is the use of implements in the lightning component? What are the different interfaces implemented in the lightning component?

Implements are used to refer to platform interfaces that make components able to be used in different contexts or to grant access to extra context data. A component can implement more than one interface.

Following is the list of all interfaces that can be implemented in lightning component:

lightning:actionOverride lightning Salesforce
lightning:appHomeTemplate lightning Salesforce
lightning:availableForChatterExtensionComposer lightning Salesforce
lightning:availableForChatterExtensionRenderer lightning Salesforce
lightning:availableForFlowActions lightning Salesforce
lightning:availableForFlowScreens lightning Salesforce
lightning:backgroundUtilityItem lightning Salesforce
lightning:hasPageReference lightning Salesforce
lightning:homeTemplate lightning Salesforce
lightning:isUrlAddressable lightning Salesforce
lightning:recordHomeTemplate lightning Salesforce
lightning:utilityItem lightning Salesforce
aura:rootComponent aura Salesforce
clients:availableForMailAppAppPage clients Salesforce
clients:hasEventContext clients Salesforce
clients:hasItemContext clients Salesforce
flexipage:availableForAllPageTypes flexipage Salesforce
flexipage:availableForRecordHome flexipage Salesforce
force:appHostable force Salesforce
force:hasRecordId force Salesforce
force:hasSObjectName force Salesforce
force:lightningQuickAction force Salesforce
force:lightningQuickActionWithoutHeader force Salesforce
forceCommunity:availableForAllPageTypes forceCommunity Salesforce
forceCommunity:layout forceCommunity Salesforce
forceCommunity:profileMenuInterface forceCommunity Salesforce
forceCommunity:searchInterface forceCommunity Salesforce
forceCommunity:themeLayout forceCommunity Salesforce
lightningcommunity:allowInRelaxedCSP lightningcommunity Salesforce
lightningsnapin:minimizedUI lightningsnapin Salesforce
lightningsnapin:prechatUI lightningsnapin Salesforce
ltng:allowGuestAccess ltng Salesforce

21) What is the difference between Lightning components and Visualforce components?

Lightning components are client-side-centric and known for their dynamic, mobile-friendly nature. On the other hand, Visualforce components are page-centric and mainly work on server-based.

22) What are the attributes, and what are the required parameters in the attribute definition?

Attributes are the variables that are used for storing the values. We should define the Default, Type, Name, Access, and Description in the attribute definition, although; only Name and Type are the required parameters.

23) What is Locker service in Salesforce lightning?

In Salesforce lightning, the Locker service is robust security architecture for the lightning components. This service is used to improve and enhance security by isolating the lightning components which belong to the namespace from the components in the distinct namespace. Locker service follows some practices that enhance the code's maintainability by providing access to the supported APIs.

24) How can we use a lightning component in the VisualForce Page?

We can embed the lightning component on the VisualForce page by using Lightning out. We should follow the following three steps to add the lightning component to the VisualForce page:

  • First, we must insert the lightning components for the JavaScript library of visual force to our intent visual force page through the tag.
  • Now, we can generate and point a lightning app that we use for the component dependencies.
  • At last, we have to write a JavaScript function that creates the component over the page through $ Lightning.createComponent().

25) What is FlexiPage in Salesforce Lightning?

FlexiPage is the metadata related to a lightning page. The lightning page specifies an adaptive screen that has several lightning components. It contains 25 components. FlexiPages are stored as XML files and deployed through a deployment tool or metadata API. These lightning pages are referred to as Flexipages in the API.

26) Are Lightning Components only directed towards mobile apps?

The Lightning Components are mainly designed with a mobile-first approach, but they have a responsive design that allows them to give the same experience even over the desktop without writing any separate lines of code.

27) What do you understand by Lightning:navigation?

The Lightning:navigation is used to navigate to a page reference or create a URL from the given page Reference. We have to define the page reference object for navigating. The page reference is the JavaScript object which references a page, offering a defined structure that explains the type of page and its respective values.

It facilitates us to navigate to the following supported features:

  • Lightning Component
  • Web Page
  • Object Page
  • Record Page
  • Named Page
  • Knowledge Article
  • Navigation Item Page
  • Record Relationship Page

28) Which Lightning components parts are server-side and which are client-side?

The component page acting as a JavaScript controller is on the client-side for the Lightning parts. On the other hand, the server-side acts as an Apex Controller.

29) What are the different types of attributes that can be used for storing the values?

Following are the different types of attributes that can be used for storing the values:

  • Boolean
  • Decimal
  • String
  • Integer
  • Date
  • Datetime
  • Map
  • Set

30) Can we integrate Lightning components with another framework like Angular?

Yes, we can integrate Lightning components with any third-party framework like Angular.

31) What are the different phases in the application events propagation?

There are mainly three phases in the application events propagation:

  • Capture Phase
  • Default Phase
  • Bubble Phase

32) What is the use of Lightning:recordEditForm?

In the Lightning:recordEditForm, the Lightning:inputField is used for creating the editable fields. Using the Lightning:output field, we can display the read-only information.

The Lightning:recordEditForm contains the following features:

  • It displays the record edit layout to edit a particular record.
  • It can also display the record to create the layout to create a particular record.

33) Can we make a Lightning Component that can be used in the mobile and desktop user interfaces?

Yes, we can make a Lightning Component that can be used in the mobile and desktop user interfaces. The Lightning Component specifies an extremely fast experience that is responsive and ready by default and has compatibility in Salesforce1 App. Its responsive nature makes it adjust as per the resolution of the screen size. So, we can use it easily on the desktop without any separate code.

34) How can we add Aura components to our Visualforce page?

There are the following three ways that a developer can choose to add the Aura components to the Visualforce page:

  • A developer can create a reference to a Lightning app for declaring the component dependencies.
  • Use the <apex:includeLightning/> component and add the Lightning component for the Visualforce JavaScript library used in your Visualforce page.
  • Use the $Lightning.createComponent() to create the component for a page by writing a JavaScript function.

35) What is the difference between <ui:input> and <lightning:input>?

The main difference between <ui:input> and <lightning:input>:

  • <ui:input>: It does not contain lightning design system styling.
  • <lightning:input>: It contains lightning design system styling.

36) What is the usage of Aura: method Tag in Lightning?

The Aura: method tag is mainly used to define component API. After using this tag, we don't need to fire and handle a component event, and it allows us to directly invoke the method in the component's controller on the client-side. It simplifies the code required for a parent component to call a method on a child component that forms a part of the parent component.

37) Is it possible to create one component for inheriting style/CSS from the parent component, or do we always need to define it in the Salesforce component?

It is completely possible to create one component for inheriting style/CSS from the parent component. We can inherit styles from parents, and it is not necessary to always define them in the Salesforce component.

38) What do you understand by an Action provider and a Value provider?

An Action provider facilitates us to manage the events, actions, and handlers for the component. On the other hand, a Value provider facilitates us to use the component attribute's value in the component JavaScript and markup controller.

39) Is it possible to include external JavaScript/CSS libraries like jQuery, bootstrap in components?

Yes, it is possible to include multiple external JavaScript/CSS libraries like JQuery, Bootstrap, custom CSS, and custom JavaScript libraries in our lightning component using a static resource.

40) How can we get the current record id in the lightning component?

To get the current record id in the lightning component, we have to add the force:hasRecordId interface to a Lightning component. It makes the component able to assign 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. This interface doesn't show any effect except when used within Lightning Experience, the Salesforce mobile app, and template-based communities.

41) What do you understand by Scratch org?

The Scratch org is an expandable Salesforce org used for testing and development. The Scratch org can be created for 30 days, after which we deactivate the Scratch org. The by default duration of Scratch org is seven days.

42) What is the use of popup in the lightning component?

Popup or Modals Boxes display content in a layer above the app. This paradigm is mainly used in cases such as creating or editing a record and various types of messaging and wizards.

43) What is the purpose of the force:appHostable interface in the Salesforce lightning component?

The force:appHostable interface is used as a custom tab in the Salesforce lightning component or mobile app.

44) How can we define the field-level security in the Salesforce lightning components?

We can use the Lightning:recordEditForm, force: record data, and Lightning: record form to define the field level security.

45) What are the different global value providers in Salesforce lightning?

Following are the different global value providers in Salesforce lightning:

  • $globalID
  • $Label
  • $Locale
  • $Browser
  • $Resource

46) How can we display the loading spinner in the lightning component?

Loading spinners are the CSS indicators we can display while retrieving the data or performing slow calculations. We can use Lightning:spinner that shows the animated spinner image indicating that a request is loading.

47: How do the capture phase and bubble phase propagate?

The capture phase propagates from top to bottom while the bubble phase propagates from bottom to top.

You may also like:

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA