Monday, 12 March 2018

Lightning Shorthand

  1. What is Salesforce lightning component framework?
The Lightning Component framework is a UI framework for developing dynamic web apps for mobile and desktop devices.

     2.  What are the different component framework ?          

     3.  Why Component Framework is future?

         Re-Usability
         Responsiveness
         Event - Driven Approach
         Highly extensible & Customizable
         Highly interactive and immersive experiences possible with lightning

    4. Visualforce Components already available for reusability so why do 
        we need   lightning  components?
        Lightning Component framework enforces developers to break application into                      components.Where as VF does not.
        Visualforce components are page-centric and most of the work is done on the                        serverLightning 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      

    5.  Lightning VS Visualforce ?

Lightning Component Framework
Visualforce
App Centric
Page Centric
Lightning, on the other hand, is a modern UI framework used in the development of dynamic web apps for desktop and mobile devices.
Visualforce enables developers to build custom user interfaces with a native hosting on the Force.com platform
It is responsive,
If you are developing for a Salesforce1 mobile app, you should prefer Lightning framework
If you want to create a page-centric experience with limited client-side logic, you must opt Visualforce framework.
UI Generation : Client-Side(Javascript)
UI Generation : Server-Side
Organizations that can’t use Apex code can’t use Lightning Components
Organizations that can’t use Apex code Still they can use Visualforce.
These applications are generally referred to as single-page applications, or SPAs, and are often built using third-party frameworks like AngularJS or React.
Visualforce provides the facility for delivering template-driven web pages and email messages

6. Single Page Application?


7. Lightning component architecture?


8. What is Aura in Salesforce Lightning?
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.
 <aura:attribute/>
<aura:iteration/>

9. What is the use of annotation ‘@AuraEnabled’ ?
    Only the methods/properties enabled with this annotation are accessible in lightning.

   @AuraEnabled
    public static List<Contact> GetContactList()
    {
            List<Contact> contList = [Select Id,FirstName,Email From Contact];
            return contList ;
    }

10. Explain the Lightning Component Configuration ?

Type
Interface Reference
Details
Lightning Tab
force:appHostable
Interface indicates the component can be

1.Hosted in the Salesforce1 Mobile app

2.Component available as a custom tab.
Lightning Page
flexipage:availableForAllPageTypes
A global interface that makes a component available in the Lightning App Builder, and for any type of Lightning page.

Lightning Record Page
flexipage:availableForRecordHome
If your component is designed only for record pages, implement the flexipage:availableForRecordHome interface instead of flexipage:availableForAllPageTypes




Lightning Record Page
force:hasRecordId
 Interface indicates the current record Id should be injected in the component’s recordId attribute

<aura:attribute name="recordId" type="Id" />
Lightning Communities Page
forceCommunity:availableForAllPageTypes
To appear in the Community Builder, a component must implement this interface
Lightning Quick Action
force:lightningQuickAction
Interface to a Lightning component to enable it to be used as a custom action in Lightning Experience or the Salesforce mobile app.

11. What is lightning component bundle ?

A bundle is sort of like a folder. It groups the related resources for a single component

Resource
Details
Component
Contains markup for the component or app
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.
Documentation
Provide Component Documentation
Renderer
Client-side renderer to override default rendering for a component.
Design
Design attribute is a configuration for admin.
Anything wanted to expose to admin to enter that attribute can be made as design attribute.
SVG
Custom icon resource for components used in the Lightning App Builder or Community Builder.

12. What is attribute in lightning component?
It’s like variable declaration in Apex,Here we can store data received from Apex to the lightning attributes.
<aura:attribute name="listAccount" type="Account[]"/>
<aura:attribute name="Name" type="String]"/>

13. What is “v” , “c”,”$A”  in lightning coding?
       

Name   
Details 
Example
v
v refers to view
var strClaimStatus = component.get("v.Name");
c
c refers to controller.
var getContDistribution  = component.get("c.GetDocAndFormList");  
$A
Its top level namespace for creation of components, getting a component, setting a component, Enqueuing Action, Running an Action
 $A.enqueueAction(getContDistribution);

14. How to debug the lightning component ?
      console.log(JSON.stringify(response.getReturnValue()));

15. How to test the lightning components ?
 After you create a component, you will want to display it somewhere. There are a number of possibilities.
Standalone Lightning app: Create a standalone Lightning app (e.g. myapp.app) and include your component in this app. Access your Lightning app by URL.

Lightning Experience: Display your component in the Lightning Experience using the App Builder. You can edit the home page, edit a record detail page or create/edit a new app page to include it. Alternatively, you can create a custom Lightning tab that references your component and add that tab to your Lightning navigation.

Salesforce1 Mobile app: Display your component in the Salesforce1 Mobile app by creating a custom Lightning tab that references it and adding that tab in your mobile navigation.

Template-based community: Display your component in your template-based (e.g. Napili) community using the Community Builder.