This tutorial provides frequently asked Salesforce Lightning interview questions and answers with explanations to help you prepare for the interview:
Salesforce is doing well, even during the time of this pandemic. The Salesforce developers are very much in demand for clients all over the world. If you want to appear for an interview, you need to be ahead of the others in the learning curve.
In this tutorial, we wish to cover one of the critical aspects of Salesforce which is the Lightning platform.
We have covered some important topics such as interfaces, component bundles, the addition of Aura components to Visualforce pages, and many more in this article.
Table of Contents:
Frequently Asked Salesforce Lightning Interview Questions
Q #1) What is Lightning in Salesforce?
Answer: Lightning is a collection of tools and technology for any form of Salesforce platform. Lightning is inclusive of the following as shown in the below table:
Sl. No. | Name | Description |
---|---|---|
1. | Lightning Experience | It comprises of Lightning Experience, template-based communities as well as Salesforce 1 mobile app. It is a set of user interfaces with optimization for speed. |
2. | Lightning Component Framework | It is a JavaScript framework that comes along with standard components and enables the developers to create components which can be reused for standalone applications. These apps are built by customization of Lightning experience, template-based communities as well as mobile apps created with Salesforce1. |
3. | Lightning App Builder and Community Builder | It offers a fast, easy way of app building and customizations with the help of drag-and-drop features. Customization of Lightning Experience is done by using Lightning App Builder for a Salesforce 1 mobile app. On the other hand community builder helps in customizations of template-based communities. |
4. | Lightning Design System (LDS) | LDS makes it possible to build apps matching the looks of the Salesforce 1 mobile app and Lightning experience. It has modern UX best practices and style guides. |
5. | Lightning Exchange | Start with development with a set of 70 + partner components as a section of AppExchange. |
Suggested reading =>> Salesforce Lightning Tutorial
Q #2) What are the components in the Lightning component framework?
Answer: The components act as functional units of the Lightning component framework. A reusable, modular section of UI is encapsulated within the components. They can range from a single line of text up to the entire application in terms of granularity.
Q #3) Where to use Lightning Components?
Answer: The Lightning components can be used in the following ways:
- Drag-and-drop components are meant for the Lightning App Builder and Community Builder.
- Add Lightning Components for Lightning Pages.
- Add Lightning Components for Lightning Experience Record Pages.
- Launch a Quick-action Lightning Component.
- Overrule the Lightning Component’s standard actions.
- Create custom applications
Q #4) What are the components bundles used in the Lightning component?
Answer: The component bundles are enlisted in the below table:
Sl. No. | Name of Component Bundle | Description |
---|---|---|
1 | Component | This contains the mark up. |
2 | Controller | This handles the events on the client side. |
3 | Helper | The developer can write the common logic inside helper used by different controller methods, avoiding any sort of repetition |
4 | Style | This is about the style of the component. |
5 | Documentation | This records the component’s use. |
6 | Renderer | This contains the default rendering behaviour of a component. |
7 | SVG | This icon in the Lightning App Builder gets displayed before the component. |
8 | Design | It not only helps in component reusability but also controls which all attributes need to exposed for the tools like Lightning App Builder. |
Q #5) How does Salesforce 1 Mobile app use Lightning components?
Answer: We first create a Lightning tab for the Lightning component and subsequently include the tab in the navigation select list of Salesforce 1 mobile app and then the newly created tab to it.
Q #6) Can a Lightning component be used that works with both interfaces – Mobile and Desktop?
Answer: It is possible to use Lightning components, Salesforce 1 mobile app, custom standalone apps directly in Lightning Experience as well as template-based communities. Lightning components are used in the Visualforce page, for use in Salesforce Visualforce communities as well as the classic environment.
Q #7) Does Lightning Component work with Visualforce?
Answer: Yes, it does work with Visualforce.
Q #8) Can Lightning be viewed as an MVC framework?
Answer: Not really. Lightning is a framework based on components.
Q #9) Which Lightning components parts are server-side and which ones are client-side?
Answer: For the Lightning component, the client-side is the component page acting as a JavaScript controller, on the contrary, the server-side acts as an Apex Controller.
Q #10) What are the differences between Lightning and Visualforce components?
Answer: Visualforce components are page-centric and work is mostly server-based. Lightning components, on the other hand, are client-side centric which accounts for their dynamic, mobile-friendly nature.
Q #11) How to add Aura components to your Visualforce page?
Answer: The developer can add the Aura components to the Visualforce page in the following three ways:
- Use the <apex:includeLightning/> component and add the Lightning component for the Visualforce JavaScript library used in your Visualforce page.
- Create a reference to a Lightning app for declaring component dependencies.
- Use the $Lightning.createComponent() to create the component for a page by writing a JavaScript function
Q #12) Can we create one component for inheriting style/CSS from the parent or we need to always define it in the Salesforce component?
Answer: Of course, we can do this. The styles can be inherited from parents and not necessarily defined in the component.
Q #13) What is the purpose of using Aura: method Tag in Lightning?
Answer: The Aura: method tag can be used for defining a method for component API. So, there is no 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 also helps to simplify the code required for a parent component to call a method on a child component that forms a part of the parent component.
Q #14) Is it possible to include a Lightning component into another?
Answer: Yes, it is possible.
Q #15) What are the limits to the number of components used in an application?
Answer: There are no limits on the usage number of the components used in an application.
Q #16) What are Aura Components? Why we use Aura: Namespace in the code?
Answer: Aura components are the self-contained and reusable units of an app. Components form the function units of Aura. Aura is the open-source technology that works for Lightning components. The building blocks for the Aura: namespace helps to define the components and applications.
Q #17) Are there any CSS (styles) provided by Salesforce.com for Supported Lightning Components?
Answer: Yes, this is available in Salesforce Lightning Design System.
Q #18) Are Lightning components meant only for mobile apps?
Answer: With a responsive design in mind, Lightning components are meant to be mobile-first. The components help to build responsive apps faster for desktops, tablets, and mobile.
Q #19) Is it possible to include external JavaScript/CSS libraries in components?
Answer: Yes, multiple libraries can be used such as JavaScript/CSS libraries, jQuery, Bootstrap, etc from a local, static resource.
Q #20) Is it possible to integrate lightning components with a framework such as Angular?
Answer: It is possible to insert the third-party code within a Visualforce page. The same Visualforce page is then put inside a Lightning component. Then the same Lightning Component is used in another Lightning component that works for various environments.
Q #21) Do you create an App Bundle first to create a Lightning component?
Answer: Not really, however, the component bundle can be created first.
Q #22) Is it possible to deploy components in the production org?
Answer: Yes, deployment of components is possible in the production with any of the following:
- Managed packages
- Force.com IDE
- Force.com
- Change sets
- Migration Tool
Q #23) How to create custom Lightning record pages in Salesforce with Lightning Experience? Can you do the same for Salesforce mobile app?
Answer: Add, remove, or you can even reorder components on a record page for a custom view of object’s records with the help of Lightning App Builder.
Yes, it is also possible to customize a record page and assign it to the Lightning apps. The users can access a custom record page for the context of the app they are working on.
Q #24) Are there any options for Lightning Record Page Assignment?
Answer: It can be assigned in different ways, such as:
- Org default
- App Default (overrides the assignment at the org level)
- App Record Type Profile (overrides the assignment at the org and app level).
Q #25) How to create a custom Lightning Record Page?
Answer: We can create it with the following steps:
Setup->App Builder in Quick Find Box->Select Lightning App Builder-> New->Record Page-> Name the page as <xxx>Select Opportunity->Choose Header, Sub header, Right Sidebar template and Click Finish.
Please go through the link for further details on creating a custom Lightning Page.
Q #26) What are the types of Lightning Record Pages in Salesforce?
Answer: Here are the types enlisted below:
- App Page
- Home Page
- Record Page
Q #27) What are the attributes? What are the parameters required?
Answer: Attributes are the variables for storing values. The attribute is defined with a name, type, default, description, and access. The <aura:attribute> tag is used that requires the values of name and type attributes.
However, name and type are the only required parameters. This is shown below:
Q #28) Which interface to use if you want your component to be available for all pages?
Answer: You can use the flexipage:availableForAllPageTypes interface.
Q #29) Which interface can be used to get the id of the record from the record Detail page?
Answer: The force:hasRecordId interface can be used for getting rid of the record from the record Detail page.
Q #30) Which interface should be used to override a standard action?
Answer: Here you can make use of the Lightning:actionOverride interface.
Q #31) Which interface is for using components in a quick action?
Answer: The interface used here is force:lightningQuickAction.
Q #32) Which interface to use a component in the record home page?
Answer: The interface used here is flexipage:availableForRecordHome.
Q #33) Which interface is used if you want a component to be used as a tab?
Answer: The interface used here is force:appHostable.
Q #34) Why Lightning:isUrlAddressable interface is used?
Answer: The lightning:isUrlAddressable interface is used when navigating to the component and also when the component to be navigated implements this interface.
Q #35) How to find data changes using data handlers?
Answer: You can configure a component for invoking a change handler when the value of the attributes in one of the many components changes.
Q #36) What are component events?
Answer: A component event is fired from the instance of a component. It can be handled by the event that fired the event or by the component in the containment hierarchy, receiving the event. There are capture and bubble phases for the propagation of component events.
Q #37) What are application events?
Answer: An application event is fired from an instance of a component. It follows a publish-subscribe model. The components that provide a handler for the event are notified. The phases supported by the framework are capture, bubble, and default phase for the propagation of application events. The capture and bubble phases have similarities with DOM handling patterns.
Q #38) What are the phases in component events propagation?
Answer: The two phases are:
- Bubble phase
- Capture phase
Q #39) What is Lightning Out?
Answer: Lightning Out is a powerful and flexible feature that allows you to embed the Lightning web components on any web page. While using this, you do not need to deal with authentication or even configure a connected app, and this simplifies some of the details when used with Visualforce.
Conclusion
We have tried to cover all the important interview questions on Salesforce Lightning. We hope we have answered some vital questions that will enable you to face this highly competitive world of Salesforce interviews.
If you have any other specific questions, please reach out to us.