This document provides an overview of developing Lightning applications. It discusses using the Lightning Design System with Visualforce pages, building Lightning components, creating a demo Lightning application, handy Lightning syntax like attributes and events, considerations like security and best practices, and references for additional learning. The document outlines the steps to set up a development environment for Lightning applications and build a sample Lightning component that fetches and displays data using Apex controllers.
2. OverView
Visualforce and Lightning Experience
Steps to use LightningDesignSystem(SLDS) with VF page
Lightning Experience Development
Steps to build Lightning Component
Lightning Application Demo
Handy Lightning Syntax
Get - Set Values
Considerations and Best Practices
References
3. Visualforce and Lightning Experience
Run a VF Page from the App Launcher
Visualforce page tab
Add a Visualforce Page to the Navigation Menu
Display a Visualforce Page within a Standard Page Layout
Add a Visualforce Page as a Component in Lightning App Builder
Launch a Visualforce Page as a Quick Action
Display a Visualforce Page by Overriding Standard Buttons or Links
Display a Visualforce Page Using Custom Buttons or Links
4. Steps to use LightningDesignSystem(SLDS) with VF page
Download the latest version of Design system from getslds.com
Add downloaded zip file as static resource.
Create a vf page and add css file(salesforce-lightning-design-system.css).
few things to note when working with the Lightning Design System in Visualforce.
Scoped within <div class="slds">
<apex:pageblock> and <apex:inputField> are not supported.
5. Lightning Experience Development
Setting Up Your Environment
Step 1: Create a Namespace
Step 2: Enable Lightning Components
Step 3: Upload SLDS as a Static Resource
6. Steps to build Lightning Component
Create an Apex Controller that exposes data and
logic to the client application.
@AuraEnabled annotation should be added to the
methods exposed to Lightning Component.
Create Lightning component(DemoComponent) from
Developer Console.
Aura Attribute DatTypes -
https://developer.salesforce.com/docs/atlas.en-
us.lightning.meta/lightning/ref_attr_types_basic.htm
Add html tags in component(DemoComponent.cmp)
which gives UI
Add logic behind the UI elements in
js(DemoComponentController.js)
Add all styles in Styles tab(DemoComponent.css)
Add component into Lightning Application and click
preview to open your App.
7. Lightning Application Demo
Basic Features:
Fetch user entered data.
Modify Data according to input and display on App.
Calling Controller methods and query Data.
Perform DML
9. Get - Set Values
Get Attribute value:
◦ component.get(‘v.number1’);
Get value by ID:
◦ component.find(‘v. Number1AuraId’).get(‘v.body’)
Set attribute value:
◦ component.set('v.number1‘,100);
Set value by ID:
◦ component.find(‘Number1AuraId’).set(‘v.body’,100);
10. Considerations and Best Practices
Delegate your business logic to helper methods.
Global variables cannot be created from controller, So alternatives are attribute or helper
variable.
Helper functions may be called from any other javascript in the component bundle.
Do not trigger DML operations in init() which will be Cross-site request forgery.
Do not fire an event in renderer, firing an event in a renderer can cause an infinite
rendering loop.
Avoid href assignment via document.location.href , instead use ‘/’ and encodeURI.
Always specify with/without sharing in apex class.
Always perform additional CRUD and FLS checks.