30 Salesforce Lightning Developer Interview Questions & Answers

Share this article...

Salesforce Developers are some of the most in demand professionals on the market, with Lightning Components and other development frameworks a hot topic at the moment.

Below are 30 questions for Salesforce Developers with experience developing Lightning Components, which will help you prepare for your next interview and stay ahead of the curve.

“Conga"

Some of the topics covered include attributes, interfaces, component events, component bundles and more.
Interested in more Developer interview questions? We have another 30 questions that cover Salesforce Development more broadly, one of our readers’ all-time favourite posts!

1. Where we can use Lightning Components?

We can use Lightning Components in the following places:

  • Drag-and-drop Components in the Lightning App Builder and Community Builder.
  • Add Lightning Components to Lightning Pages.
  • Add Lightning Components to Lightning Experience Record Pages.
  • Launch a Lightning Component as a Quick Action
  • Override Standard Actions with Lightning Components
  • Create Stand-Alone Apps

2. How do you build Lightning Components?

We can build Lightning Components using two programming models: the Lightning Web Components model, and the original Aura Components model.

3. How can you create Lightning Record Pages in Salesforce, and what are the different types?

We can make use of Lightning App Builder for creating Lightning Record Pages, to create the following three types of pages:

  • App Page
  • Home Page
  • Record Page

4. What options are there for Lightning Record Page assignment?

“Lightning Pages” can be assigned at three different levels:

  • The org default
  • App default – this overrides the assignment done at the org level
  • App, record type, profile – this overrides the assignment done at org level and at the App level.

5. What are attributes? What are their required parameters?

Attributes are variables which are used to store values. We specify the Name, Type, Default, Description, Access in the attribute definition. Only Name and Type are required parameters in the attribute definition, for example:

<aura:attribute name="firstName" type="String"/>

6. What are the types of attributes that we can use to store values?

We can use different types of attributes, listed below:

  • String
  • Integer
  • Boolean
  • Date
  • Datetime
  • Double
  • Decimal
  • Long
  • Array
  • List
  • Set
  • Map
  • Standard object attribute – example: <aura:attribute name=”contactObj” type=”Contact”
  • Custom object attribute – example A: aura:attribute name=”customObjectList” type=”customObject__c[]”/>
    OR example B: <aura:attribute name=”customObject” type=”customObject__c”/>

7. How can you access a value from an attribute?

Use “Value Provide” which is denoted with the symbol “v”, for example:

&lt;aura:attribute name="firstName" type="String"/&gt;

8. How can you call a javascript controller action from a component markup?

We can use action provider to call a javascript controller action from the component markup, for example:

In the component markup: &amp;lt;lightning:button label="SUBMIT" onclick="{!c.doSubmit}"/&amp;gt;

In the controller:

({

doSubmit:function(component, event, helper) {

// Some operations.

}

)}

9. Which interface should you use if you want to get the id of the record from the record

Detail page?

You can use the force:hasRecordId interface. Use this as opposed to the {!v.recordId} in controller we can get the id of the current record.

10. Which interface should you use if you want your component to be available for all pages?

You can use the flexipage:availableForAllPageTypes interface.

11. Which interface should you use if you want to override a standard action?

You will need to use the Lightning:actionOverride interface.

12. Which interface should you use if you want your component to be available only on the record home page?

You will need to use the flexipage:availableForRecordHome interface.

13. Which interface should you use if you want your component to be used a tab?

You will need to use the force:appHostable interface.

14. Which interface should you use if you want your component to be used a quick action?

You will need to use the force:lightningQuickAction interface.

15. How can you detect a change in an attribute value, and call a controller method based on a change?

You can use of the below handler:

&lt;aura:handler name="change"value="{!v.&lt;strong&gt;attributeNameWhereValueChangeOccured&lt;/strong&gt;}"action="{!c.doinit}"/&amp;gt;

Note: attributeNameWhereValueChangeOccured is the attribute name where we are detecting the change.

16. How can you call the controller method based on a component load?

We can make use of the below handler:

&lt;aura:handler  name="init" value="{!this}" action="{!c.doInitialization}"/

17. What are component events?

Component events are events which are fired by child components and handled by the parent component. We can make use of this event when we need to pass a value from a child component to parent component.

18. What are application events?

Application events can be fired from any component and can be handled by any component. They do not require any kind of relationship between the components, but these components must be a part of a single application.

19. Why would you use aura:method?

You can use a aura:method to pass value from a parent component controller to a child component controller.

For example:

ParentComponent.cmp

&lt;aura:component&gt;
 &lt;c:ChildComp aura:id="ChildCompId"/&gt;
&lt;/aura:component&gt;

INSIDE ParentComponentController.js

var childCompId=component.find("ChildCompId"); 
var res=childComponent.chilCompMethod("From parent");

INSIDE ChildComponent.cmp

&lt;aura:component&gt;
 &lt;aura:method name="chilCompMethod" action="{!c.doAction}"&gt;
    &lt;aura:attribute name="receiveValueFromParent" type="String" /&gt;
&lt;/aura:method&gt;
&lt;/aura:component&gt;

INSIDE ChildComponentController.js

({
doAction:function(component, event, helper){
 var params=event.getParam('arguments');
        if(params)
      {
           var param1=params.receiveValueFromParent;}
       return param1+"Appended child value";}
)}

20. How can you define field level security in Lightning Components?

You will need to use Lightning:recordForm, Lightning:recordEditForm, Lightning:recordViewForm, force:recordData.

21. What is Lightning Out?

If you want to use your component on an external site, you will need to use Lightning Out. The best advantage of Lightning Out is you can use the Lightning Component inside a Visualforce page and vice versa. 

For more information on Lightning Out and how you can use Visualforce inside a Lightning component (and vice versa), check out our Salesforce Summary article on this topic.

22. What is force:recordData, and what are its advantages?

force:recordData is a standard controller of a Lightning Component. We can perform an operation such as creating a record, editing a record,deleting a record using force:recordData. If we are using force:recordData, it identifies and eliminates the duplicate request going to the server if they are requesting for the same record data (which in turn improves performance).

23. What are all component bundles we deal with while working with Lightning Component?

Following are the component bundles we deal with while working with Lightning Component.

  • Component: contains markup.
  • Controller: handles the client side events.
  • Helper: write the common logic inside helper which can be used by different controller methods, avoiding repetition.
  • Style: contains the style for the component.
  • Documentation: used to record the component’s use.
  • Renderer: contains the default rendering behaviour of a component.
  • SVG: the icon which gets displayed before the component name in the Lightning App Builder.
  • Design: control which attribute we can expose to tools like the Lightning App Builder. It helps with component re-usability.

24. What are the phases in component events propagation?

There are two phases in component event propagation.

  1. Bubble Phase
  2. Capture Phase

25. What are the phases in application events propagation?

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

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

  • Bubble phase: propagates from Bottom to Top.
  • Capture phase: propagates from Top to Bottom.

27. What are bound and unbound expressions?

Bound and unbound expressions are used to perform data binding.

While calling a child component from a parent component, we can pass the value to an attribute of a child component from a parent component attribute.

An example of a bound expression:

Parentcomp.cmp

&lt;aura:component&gt;

&lt;c:ChildComp childAttributeName="{!v.parentAttributeName}" /&gt;

&lt;/aura:component&gt;

childAttributeName=“{!v.parentAttributeName}” is a bound expression, change to the value of the childAttributeName attribute in child component also changes the value of parentAttributeName attribute in parent component and vice versa.

An example of an unbound expression:

Parentcomp.cmp

&lt;aura:component&gt;

&lt;c:ChildComp childAttributeName="{#v.parentAttributeName}" /&gt;

&lt;/aura:component&gt;

childAttributeName=“{#v.parentAttributeName}”  is a Unbound expression, changes to the value of the childAttributeName attribute in child component has no effect on the value of parentAttributeName attribute in parent component and vice versa.

28. What is Aura?

Aura is a framework design by Salesforce for creating UI components. It is an open-source framework.

29. What is Lightning:navigation? How can we navigate using Lightning:navigation?

Lightning:navigation is used to navigate to a given pageReference or to generate a URL from a pageReference. To navigate, we need to define a PageReference object.

Pagereference is a javascript object that references a page, providing a well-defined structure that describes the page type and its corresponding values.

The following are supported features where we can navigate to:

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

Example: To navigate to a component, we use the below syntax while defining pagereference:

{

"type": "standard__component",

"attributes": {

"componentName": "c__MyLightningComponent"

},

"state": {

"myAttr": "attrValue"

}

}

30. What is Lightning:isUrlAddressable interface?

If we are navigating to a component, then the component where we are navigating to must implement lightning:isUrlAddressable interface to navigate there successfully.

5 thoughts on “30 Salesforce Lightning Developer Interview Questions & Answers

    1. Avatar

      Good list. May I suggest you mark each question if it applies to Aura or LWC. I had an interview where they read straight down this list of questions. I asked for clarification several times, and he said it applies to lightning. I’m not sure if they understood that lightning components are just one piece of being a SF developer as there wasn’t a single question other than the list.

      1. Lucy Mazalon

        Hi Drew, thanks a lot for your suggestion. We’ll get working on this update. Good to hear that the questions are being used in real scenarios!

Leave a Reply