Learn Salesforce Anywhere Anytime

Theme Switch

Imp Questions


What is @AuraEnabled? 

Aura Enabled is an annotation in apex that makes your Apex methods and their properties available to the lightning component.

Make sure your method is static if you are using @AuraEnabled annotation in your Apex Controller.

/*Annotation to make apex method available 
to lightning components */
public static Account getAccount(Id accountId) {
   // your code here

What are we referring to Controller in the Aura component?

The Controller we refer to in the Aura Component is the Apex Class, which acts as an Apex Controller or server-side controller to fetch and set the data into the server.

<aura:component controller="getOrdersData"  

So getOrdersData is the Apex Controller or Class here, which acts as the server-side controller.

What is the use of a helper file in an Aura Component?

It’s a best practice to use a helper whenever you are going to make a server call, and a helper file is used to create reusable functions to call them in the controller(client-side controller).

What will you use if you need to sent data Parent Component to Child Component?

Attributes are used to send data from the Parent to the Child component.

How many types of events do we have in Aura Component? Name them?

  1. Standard Event
  2. Component Event
  3. Application Event

What is the name of the Collection variable that is not allowed in @AuraEnabled Methods as a return type?

Set is the Collection variable that you can’t return in the AuraEnabled Method.

Can we set Aura Enabled methods as static?

No Aura Enabled Methods need to be static. Else they will throw an error.

Which Interface is required to make the Lightning component available for the Lightning Record Page?

By implementing force:availableForRecordHome interface

What happens if an Apex method that is not Aura Enabled and Apex is used as a controller in the lightning component?

That method that is not Aura Enabled is not available for the Lightning Component, so make sure you add @AuraEnabled to the lightning Component.