1. What is Salesforce Lightning?

Salesforce Lightning is a group of technologies and tools that are behind an important upgrade to the Salesforce platform. Salesforce lightning contains the following components:

  1. Lightning Component Framework: It is a java-script framework and a collection of general components that allow us to develop the recyclable components for personalizing the Salesforce1 Mobile App, and Lightning Experience.
  2. Experience: It relates to a set of advanced user interfaces that we optimize for speed. 
  3. Lightning Exchange: It relates to a part of App Exchange where we find more than 70 partner components to start the development.
  4. Lightning Design System: It relates to the best practices and style guides of advanced enterprise UX to build pixel-perfect apps. 
  5. Visual Building tools: It relates to drag-and-drop technologies for easy and quick customization and app building.

2. How do we develop Lightning components?

Using two programming models, we can develop the lightning components;

  1. Native Aura Components model
  2. Lightning web components model.

3. What is Aura, and what is the use of aura: namespace?

Aura is a freeware technology that powers the lightning components. Aura: namespace comprises all the main building blocks to define applications and components.  

4. Explain Lightning experience?

Lightning experience is the name for the latest Salesforce desktop application, with the latest features, developed with an advanced User Interface(UI) and speed optimization.

5. Explain different types of events of Salesforce lightning components?

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

  1. System Events: During the lightning app lifecycle, Salesforce fires the system events.
  2. Application Event: The application event extent is across the lightning application, and any element that has enrolled for his event will get an alert.
  3. Component Event: The component event scope is within itself, or within the parent component of this event, all the parent components will get an alert.

6. Explain the Aura application bundle?

A bundle includes Aura definitions and their associated resources. The aura definition can be an application, interface, component, and event. Aura Definition Bundle element is a folder that includes definition files, contrary to other metadata components, the aura definition bundle component is not a single file; it is a group of files.

7. Explain the Lightning design system?

The lightning design system provides style guides and advanced UX best practices for building pixel-perfect applications that match the feel and look of the salesforce1 mobile app and lightning experience.

8.What is Lightning Data Service?

We use lightning data service for creating, deleting, editing, or loading a record in our component without Apex code. It handles field-level security and sharing rules. Lightning data service enhances the user interface and performance consistency. The lightning data service’s main advantage is we can carry out basic tasks without Apex code.

9. What are the component bundles of the lightning components?

 Following are the component bundles of the lightning components:

  1. Controller: Controller tackles the client-side events.
  2. Style: It includes component style.
  3. Documentation: We use this component bundle for recording the component’s use.
  4. Renderer: The renderer component bundle contains a component default rendering behavior.
  5. Helper: we can write the general logic in the helper that is used by various controller methods to avoid repetition.

10. How can we use Lightning components with Salesforce1 Mobile App?

 We can use Lightning Components with the Salesforce1 mobile app by creating a traditional lightning tab that refers to the component, and we can add that tab to the Salesforce1 mobile navigation.

11. Explain Lightning out?

 If we want to use our component on the external site, we have to use lightning out. The advantage of lightning out is we can utilize lightning components in a visual force page. 

12. Explain Attributes, and what are the required parameters in the attribute definition?

 Attributes are variables that we use for storing the values. We must define the Default, Type, Name, Access, and Description in the attribute definition. In the attribute definition, only Name and Type are the required parameters.

13. How can we utilize a lightning component in the Visual Force Page?

 By using Lightning out, we can embed the lightning component on the Visual Force page. We can add the lightning component to the Visual Force page in three steps:

  1. First, we must insert the lightning components for the javascript library of visual force to our intent visual force page through the tag.
  2. After that, we can generate and point a lightning app that we use for the component dependencies.
  3. Finally, we have to write a javascript function that creates the component over the page through $Lightning.createComponent().

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

By using Lightning App Builder, we can create lightning record pages. Following are different types of lightning record pages:

  1. Record page
  2. App page
  3. Home page

15. Differentiate Component Event and Application Event?

We use the component event for interaction between the parent and child. We can communicate the change in the child component to the parent component through the component event. We use Application events to send any modification in the component to a wide audience. The components registered for this event will get an alert. 

16. Explain @AuraEnabled Annotation?

 The AuraEnabled annotation allows the lightning components for accessing the Apex properties and methods. AuraEnabled annotation is overloaded, and we use it for distinct purposes.

  1. We use AuraEnabled on the Apex class static methods for making them accessible like remote controller actions in our lightning components.
  2. We use @AuraEnabled on the Apex Instance methods and properties for making them serializable when we return the class instance like the data from the server-side action.

17. What is the importance of the aura: method tag in the Salesforce Lightning?

We use the aura: a method for defining the method within the API of the component. This allows us to call a method directly in the client-side controller of a component rather than handling or dismissing an event. Through <aura: method>, we can simplify the code which the parent component requires for calling a method on the child component.

18. Explain force: record data?

The force: record data is a conventional controller of the lightning component. We can accomplish the operations like deleting, creating, and editing a record through force: record data. If we want to use force: record data, it removes and recognizes the replicate request passing to the server if we request for the same record data.

19. Explain unbound and bound expressions?

 We use unbound and bound expressions for performing the data binding. When we call a child component from the parent component, we can send the value to a child component attribute from the attribute of a parent component.

20. Explain Lightning: navigation?

We use lightning: navigation for navigating to a page reference or creating a URL from the given page Reference. For navigating, we have to define the page reference object. page Reference is the javascript object which references a page, offering a defined structure that explains the type of page and its respective values.

We can navigate to the following supported features:

  1. Lightning Component
  2. Named Page
  3. Knowledge Article
  4. Record Page
  5. Object Page
  6. Navigation Item Page
  7. Web Page
  8. Record Relationship Page.

21. Explain FlexiPage?

FlexiPage portrays the metadata related to a lightning page. The lightning page portrays an adaptive screen composed of regions comprising the lightning components. The lightning page contains 25 components. We store the Flexi page as an XML file, and we deploy it through a deployment tool or metadata API. We refer to the lightning pages as Flexipages in the API.

22. Explain Locker service in Salesforce lightning?

Locker service is a robust security architecture for the lightning components. The locker service improves security by isolating the lightning components which belong to the namespace from the components in the distinct namespace. Locker service supports the practices which enhance the maintainability of our code by enabling access to the supported APIs.

23. What is the importance of the implements in the lightning component?

We use implements for referring to the platform interfaces that allow us to use the components in various contexts, or grant access to additional context data, and by using implements, a component can implement multiple interfaces.

24. What are the different types of attributes which we can use for storing the values?

 We use the following attributes for storing the values:

  1. Boolean
  2. Integer
  3. String
  4. Datetime
  5. Date
  6. Decimal
  7. Map
  8. Set

25. What are Component events?

Components events are the events that child components dismiss, and parent components handle. We use component events when we want to send a value from the child component to the parent component.

26. Where can we use the lightning components?

 In the following places, we can use lightning components:

  1. Drag-and-drop components in the community builder and lightning app builder.
  2. Add lightning components to the lightning pages.
  3. Start the lightning component like a quick action.
  4. Create stand-alone applications.

27. What are Application events?

 Any component can dismiss and handle the application events. Application events do not need any type of relationship among the components, and these components should be a part of one application.

28. What are the different phases in the application events propagation? 

  1. Capture Phase
  2. Default Phase
  3. Bubble Phase.

29. Explain Lightning App Builder?

We use lightning app builder for creating the lightning pages for the mobile applications and salesforce lightning experience. A lightning app builder is a click-and-point tool, and we build the lightning pages through the lightning components, which are configurable, reusable, and compact. Through lightning app builder, we can build different types of pages:

  1. Home page
  2. App Page
  3. Record Page

30. Explain Namespace in the salesforce lightning components?

We use Namespace for grouping the components together. The lightning components that we use are a part of a Namespace. C is the default namespace, and we can create our namespace through our organization. If we create the namespace for our organization, then we can use that namespace for our lightning components.

31. What is the difference between <ui:input> and <lightning:input>

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

32. What is the use of Lightning:recordEditForm?

In the lightning:recordEditForm, we use the lightning:inputField for creating the editable fields. By using the lightning: output field, we can display the read-only information. lightning:recordEditForm contains the below features:

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

Salesforce Lightning Interview Questions and Answers

33. What is an Action provider and Value provider?

Action provider allows us to manage the events, actions, and handlers for the component.

The value provider allows us to use the component attribute’s value in the component javascript and markup controller.

34. Explain Lightning Web Components(LWC)?

By using lightning web components, we can build the lightning components. Lightning web components are the traditional HTML elements built through the advanced javascript and HTML elements. We can build the components by using any model and locate the components on the lightning page. To develop the lightning web components, we need “Salesforce Extensions for the Visual Studio code”, and to deploy the LWC from the organization we need “salesforce CLI”.

35. Explain Scratch org?

Scratch org is an expandable salesforce org that we use for testing and development. We can create the scratch org for 30 days after which we deactivate the Scratch org. Scratch org default duration is seven days.

36. What is the use of the meta configuration file in the Lightning Web Component(LWC)?

The meta configuration file specifies the metadata values to the components. If we do not have a configuration file for our component, we will get an error when we push our changes.

37. What is the use of Javascript in the LWC(Lightning web components)?

  1. Javascript establishes HTML properties behavior.
  2. If we have to import a function, class, and variable defined in the module, we have to use the import statement.
  3. Javascript files in the LWCs are the ES6 modules. Everything we declare in the module is local.
  4. lwc is the core module of the lightning web components. “Import” statement imports the LightningElement from the lwc module. 

38. What is the purpose of the force:appHostable interface in the Salesforce lightning component?

In the Salesforce mobile app or the lightning component, we can use the force:appHostable interface as a custom tab.

39. What is the purpose of the Lightning: action override in the Salesforce Lightning Component?

The Lightning: action override allows us to use the component like an override for the standard action. We Override the New, Edit, Tab, and View the standard actions over the traditional and standard components. Components must implement the Lightning: action override interface that the component emerges in the lightning component bundle menu.

40. What are the tools present in lightning?

  1. Lightning schema builder: Schema builder is a user interface tool to create and view the fields, objects, and relationships.
  2. Lightning Connect: This is the integration tool that makes it simpler for our Force.com app for consuming the data from the external source, which compiles to OData spec.
  3. Lightning Process Builder: It is a user interface tool to visualize and create automated business processes.
  4. Lightning Component Framework: Extensions and components which enable you to build the recyclable components personalize the salesforce1 mobile app and develop independent apps.
  5. Lightning App Builder: This is the latest user interface tool that allows us to build lightning apps quickly, through components given by the Salesforce platform developers.

41. How do the capture phase and bubble phase propagate? 

  1. Capture phase: This phase propagates from top to bottom
  2. Bubble phase: This phase propagates from bottom to top

42. How can we define the field-level security in the Salesforce lightning components?

To define the field level security, we should use Lightning:recordEditForm, force: record data, and Lightning: record form.

43. What are the options for the lightning record page assignment?

 We can assign the lightning pages at three distinct levels:

  1. Org default
  2. App default: This assignment revokes the assignment done at the org level.
  3. App, profile, record type: This assignment revokes the assignment done at App and org level.

44. How can we access the value from the attribute?

By using “ValueProvide”, we can access the value from the attribute.

45. What are the various Global value providers in lightning?

Following are the various Global value providers:

  1. $globalID
  2. $Label
  3. $Resource
  4. $Locale
  5. $Browser

46. Can we integrate the Lightning components with other frameworks like Angular?

Yes, we can integrate the lightning components with other frameworks.

47. Can we add the external CSS or Javascript libraries like bootstrap, jquery to the components?

Yes, we can add the Javascript and CSS libraries to the lightning components.

48. How do we assure FLS when working with the Lightning components?

In the APEX controller, we must enforce the CRUD and FLS manually. Also, while using Lightning data service, it takes care of CRUD and FLS.

49. How can we display the loading spinner in the lightning component?

Spinners are the CSS indicators which we should display while retrieving the data or performing slow calculations. Lightning: spinner shows the animated spinner image for indicating that a request is loading.

Salesforce Lightning Interview Questions

50. 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.

51. 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.

52. Is Lightning an MVC framework?

No, it’s a component-based framework.

53. 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.

54. What are the different Lightning component bundles?

  • Component :UI for lightning component
  • Controller: Contains client-side controller methods to handle events in the component.
  • Helper: JavaScript functions that can be called from any JavaScript code in a component’s bundle
  • 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.

55. 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.

56. 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.

57. 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.

58. 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.

59. 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.

60. 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.

61. 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:

SuffixComponent Type
.appApplication
.cmpComponent
.designDesign
.evtEvent
.intfInterface
.jsController, Helper, or Renderer
.svgSVG Image
.cssStyle
.auradocDocumentation
.tokensTokens collection

62. 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.

63. 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.

64. 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.

65. 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.

66. How to call apex class from lightning component

The AuraEnabled 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.

67. Can we Include One Lightning component to another ?

Yes we can include one Lightning component inside another Lightning component

68. 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.

69. 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:

  1. We have to first Add the Lightning Components for Visualforce JavaScript library to your targetted Visualforce page using the tag.
  2. Next we have to create and refer a Lightning app which is used to the component dependencies.
  3. Lastly we need to write a JavaScript function which will finally create the the component on the page using $Lightning.createComponent()

70.Can we integrate Lightning components with another framework like Angular?

Yes, we can integrate lightning with any 3rd party framework.

71. Can we include external JavaScript/CSS libraries like jQuery, bootstrap in components?

Yes, we can use multiple libraries in our lightning component like JQuery, Bootstrap, custom CSS and custom Javascript libraries using static resource.

72. 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.

73. 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.

74. 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  and Lightning Spinner in LWC (Lightning Web Component)

75. 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

76. 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.

77. 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.

78. 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.

79. 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.

80. 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).