Skip to content

Salesforce Lightning Interview Questions and Answers

Salesforce Lightning Interview Questions and Answers.

Salesforce Lightning Interview Questions

Q1. What is Salesforce Lightning?

Lightning includes the Lightning Component Framework and a collection of tools for developers such as:

  • Lightning components – Develop reusable components
  • Lightning App Builder – Build Lightning Pages with Click not Code
  • Experience Builder – Build Communities with Click not Code

Q2. What is Lightning Component Framework?

The Lightning Component framework is a UI framework for developing web apps for mobile and desktop devices. It’s a modern framework for building single-page applications with dynamic, responsive user interfaces for Lightning Platform apps. It uses JavaScript on the client side and Apex on the server side. Salesforce supports two types of Lightning Component Frameworks:

  • Aura Components
  • Lightning Web Components

Q3. What are Aura Components?

Aura components are the self-contained and reusable units of an app. They represent a reusable section of the UI, and can range in granularity from a single line of text to an entire app. The framework includes a set of prebuilt components such as:

  • Component or Application –  Contains markup for the component or app. Each bundle contains only one component or app resource.
  • CSS Styles – Contains styles for the component
  • Controller – Contains client-side controller methods to handle events in the component.
  • Design – File required for components used in Lightning App Builder, Lightning pages, Experience Builder, or Flow Builder.
  • Documentation – A description, sample code, and one or multiple references to example component.
  • Renderer – Client-side renderer to override default rendering for a component
  • Helper – JavaScript functions that can be called from any JavaScript code in a component’s bundle.
  • SVG File – Custom icon resource for components used in the Lightning App Builder or Experience Builder.

All resources in the component bundle follow the naming convention and are auto-wired. For example, a controller <componentName>Controller.js is auto-wired to its component, which means that you can use the controller within the scope of that component.

Q4. What are Lightning Web Components (LWC)?

Lightning Web Components (LWC) is a new programming model for building Lightning components. It leverages the latest web standards, can coexist and interoperate with the original Aura programming model, and delivers better performance as compared to Aura Components. LWC leverages custom elements, templates, shadow DOM, decorators, modules, and other new language constructs available in ECMAScript 7 and beyond. Lightning Web Components provides a layer of specialized Salesforce services on top of the core stack, including:

  • The Base Lightning Components, a set of over 70 UI components all built as custom elements.
  • The Lightning Data Service which provides declarative access to Salesforce data and metadata, data caching, and data synchronization.
  • The User Interface API, the underlying service that makes Base Lightning Components and the Lightning Data Service metadata aware, leading to substantial productivity gains.

Q5. What are the key component of a LWC?

LWC consists of a JavaScript file, an HTML file, and optionally a CSS file. A component needs a folder and its files with the same name.

HTML –  provides the structure for your component. (Filename: firstApp.html)

<template>
    <input value={welcomeMessage}></input>
</template>

JavaScript – defines the core business logic and event handling. (Filename: firstApp.js)

import { LightningElement } from 'lwc';
export default class firstApp extends LightningElement {
  welcomeMessage = 'Welcome to Forcepective!';
}

CSS – provides the look, feel, and animation for your component. (Filename: firstApp.css)

input {
   color: orange;
}
Top Salesforce Interview Questions and AnswersSalesforce Integration Interview QuestionsSalesforce Vlocity Interview QuestionsJavaScript Interview QuestionsSalesforce Flow Interview Questions
Popular Interview Questions

Salesforce Lightning Interview Questions and Answers

Q6. What are Lifecycle Hooks in Lightning Web Components?

Lightning Web Components provides methods that allow you to “hook” your code up to critical events in a component’s lifecycle. These events include when a component is:

  • Created
  • Added to the DOM
  • Rendered in the browser
  • Encountering errors
  • Removed from the DOM

You can respond to any of these lifecycle events using callback methods. For example, the connectedCallback() is invoked when a component is inserted into the DOM. The disconnectedCallback() is invoked when a component is removed from the DOM.

Q7. What are Decorators?

Decorators are often used to modify the behavior of a property or function.

To use a decorator, import it from the lwc module and place it before the property or function.

import { LightningElement, api } from 'lwc';
export default class firstComponent extends LightningElement{
    @api welcomeMessage;
}

You can import multiple decorators, but a single property or function can have only one decorator. For example, a property can’t have @api and @wire decorators. Some of the decorators are:

  • @api – To expose a public property or method, decorate a field with @api.
  • @track – To tell the framework to observe changes to the properties of an object, decorate the field with @track.
  • @wire – Gives you an easy way to get and bind data from a Salesforce org.

Q8. How can you display Lighting Web Components in an Org?

There are two ways to to display a Lightening Web Component in the UI:

  1. Set the component to support various flexipage types (home, record home, and so on) then add it to a flexipage using the Lightning App Builder. 
  2. Create a tab which points to an Aura component containing your Lightning web component.

Q9. What is Lightning Component Library?

The Lightning Component Library is the hub for Lightning UI developer information, including reference information, developer guide, and Lightning Locker tools. Component Reference includes documentation and reference information for the base components. You can access Lightning Component Library here!

Q10. What is Lightning Locker?

Lightning Locker is a Salesforce architectural layer that enhances the security of the third-party Lightning components used in your site and custom code in your head markup. These third-party components and custom code may contain security vulnerabilities that enable the exfiltration of data and potentially malicious actions using that data. Lightning Locker controls whether third-party components and custom code from different namespaces can share data or interfere with each other.


Salesforce Lightning Interview Questions and Answers


Q11. What are Events in Salesforce Lightning Components?

Events are fired from JavaScript controller actions. Events can contain attributes that can be set before the event is fired and read when the event is handled. Events are declared by the aura:event tag in a .evt resource. There are two type of Events:

  • Component Events – 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. Component events can only be handled by components above them in the containment hierarchy so their usage is more localized to the components that need to know about them.
  • Application Events – Application events follow a traditional publish-subscribe model. An application event is fired from an instance of a component. All components that provide a handler for the event are notified. 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.

Q12. Explain Event Best Practices.

Here are some best practices for working with events:

  • Use Component Events whenever possible – Always try to use a component event instead of an application event, if possible. Component events can only be handled by components above them in the containment hierarchy so their usage is more localized to the components that need to know about them.
  • Use Application only if required – 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.
  • Separate low level Events from Business Logic Events – Handle low-level events, such as a click, in your event handler and refire them as higher-level events, such as an approvalChange event or whatever is appropriate for your business logic.
  • Dynamic Actions based on component state – Invoke a different action on a click event depending on the state of the component.
  • Using a dispatcher component to listen and relay Events – If you have a large number of handler component instances listening for an event, identify a dispatcher component to listen for the event. The dispatcher component can perform some logic to decide which component instances receive further information, and fire another component or application event targeted at those component instances.

Q13. What are Global Value Providers in Salesforce Lightning?

Global value providers are global values and methods that a component can use in expressions.

Global Value ProviderDescription
globalIDThe globalId global value provider returns the global ID for a component. Every component has a unique globalId, which is the generated runtime-unique ID of the component instance.
$BrowserThe $Browser global value provider returns information about the hardware and operating system of the browser accessing the application.
$ContentAssetThe $ContentAsset global value provider lets you reference images, style sheets, and JavaScript used as asset files in your lightning components.
$LabelThe $Label global value provider enables you to access labels stored outside your code.
$LocaleThe $Locale global value provider returns information about the current user’s preferred locale.
$ResourceThe $Resource global value provider lets you reference images, style sheets, and JavaScript code you’ve uploaded in static resources.

Q14. Explain Lightning Data Service.

Lightning Data Service is used 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 simplifying access to Salesforce data, Lightning Data Service improves performance and user interface consistency. In order to improve performance. Lightning Data Service:

  • Loads record data progressively.
  • Caches results on the client.
  • Invalidates cache entries when dependent Salesforce data and metadata changes.
  • Optimizes server calls by bulkifying and deduping requests.

Q15. What is the use of Continuation Class in Apex?

Continuation class in Apex is used to make a long-running request to an external Web service. Response is processed in a callback method. An asynchronous callout made with a continuation doesn’t count toward the Apex limit of 10 synchronous requests that last longer than five seconds. Because continuations can lead to multiple long-running actions, there are limits on their usage. Some of the key limits specific to Lightning Web Components are:

  • Up to three callouts per continuation – A single Continuation object can contain a maximum of three callouts.
  • Serial processing for continuation actions – The framework processes actions containing a continuation serially from the client. The previous continuation invocation must have completed before the next continuation invocation is made. At any time, there can be only one continuation in progress on the client.
  • DML operation restrictions – An Apex method that returns a Continuation object can’t perform any Data Manipulation Language (DML) operations. You can perform DML operations in the Apex callback method for the continuation.

This article will be updates soon, please come back for more Salesforce Lightning Interview Question and Answers!

Business AnalystSalesforce Certified Strategy Designer Badge LogoSalesforce Certified User Experience Designer BadgeSalesforce Certified Associate BadgeSalesforce Certified Administrator LogoSalesforce Certified Sales Representative Badge
Popular Salesforce Certification Guides

Salesforce Lightning Interview Questions and Answers

Q16. What is Experienced Page Time (EPT)?

Experienced Page Time (EPT) is how Salesforce measures the time it takes to download and display the entire content of a webpage in a browser window. In other words, measuring EPT is really about ensuring your users get the best user experience possible.

Salesforce offers four ways to measure EPT.

  • Lightning Experience – Add an EPT counter to Lightning Experience.
  • Lightning Usage App – View aggregated page and browser performance.
  • Custom Reports – Build custom reports using Lightning Usage App objects.
  • Event Monitoring – Use event types to monitor performance.

Add the following string to the end of your Lightning Experience URL: ?eptVisible=1. This will add the page load time counter to your Lightning Experience header.

Salesforce Lightning Interview Questions - Experienced Page Time in Salesforce Lightning

There are four main factors that can adversely affect EPT: 

  1. Network – Conditions and “distance” between the device and the host instance.
  2. Device – Available processing power, memory, and resources of your devices.
  3. Browser – Specific browser processing capabilities and configuration.
  4. Salesforce Configuration – Lightning page customizations, Visualforce implementations, or specific org customizations.

Q17. What is the Lightning Usage App?

The Lightning Usage App is a used to track adoption and usage of Lightning Experience, so you can monitor progress and make informed decisions. It provides insights such as daily active users, the number of users switching to Salesforce Classic per day, and the most visited pages in Lightning Experience.

The Lightning Usage App is free to all Salesforce customers and available right from Lightning Experience. You can access the app using App Launcher icon in the navigation bar. In the App click tabs in the ACTIVITY or USAGE sections on the left side of the page to view the associated data.

Salesforce Lightning Interview Questions - Salesforce Lightning Usage App

Q18. What is Octane Score?

Octane score is a benchmark that measures a JavaScript engine’s performance by running a series of automated tests. The higher the Octane score, the better your Lightning Experience performance will be. You can find the Octane score for a specific device by appending “speedtest.jsp” to your org’s domain.

Salesforce Lightning Interview Questions - Octane Score

Additional Resources

This article will be updated soon, please come back for more Salesforce Lightning Interview Questions and Answers!


Additional Salesforce Interview Questions

Tags:

Share this article...

Please Leave a Comment

error: Content is protected !!

Discover more from DYDC

Subscribe now to keep reading and get access to the full archive.

Continue reading