Salesforce Lightning Interview Questions
In this post I am going to share Salesforce Lightning Interview Questions
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.
- 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.
- 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:
|.js||Controller, Helper, or Renderer
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.
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:
- Next we have to create and refer a Lightning app which is used to the component dependencies.
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.
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?
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?
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.
For more details, refer to below link Modal/Popup Lightning Component Salesforce
If you have any other useful question answer related to Salesforce Lightning Interview Questions, please add in comment section.
Please refer to below links for more detail about lightning:
Lightning Design System
Lightning Experience Rollout Specialist
Lightning Component Framework Specialist
Lightning Experience Specialist
Lightning Components Developer Guide
I will keep adding more questions to Salesforce Lightning Interview Questions.
For other interview questions please refer to Salesforce interview questions