SlideShare a Scribd company logo
1 of 54
Download to read offline
Building Lightning Components
​ Christophe Coenraets
​ Developer Evangelist
​ Salesforce DUG NYC
​ 11/11/2015
​ 
​ #TrailheadLive
​ @ccoenraets
http://developer.salesforce.com/trailhead/projects
Step 1:
Setting Up Your Environment
1.  Sign up for a Developer Edition Org
2.  Enable Lightning Components
Challenge
Step 2:
Enabling Geolocation on Accounts
1.  Add a geolocation field to the Account object
2.  Enter sample data
Challenge
Step 3:
Creating an Aura-Enabled Controller
Visualforce Page-Centric Model
1.  Browser requests page
Client Server
4.  Browser renders html
2.  Server executes Apex code
3.  Server returns page (html + data)
Show different data? Back to 1
Show different view? Back to 1
Pros
1.  Proven model
2.  Productivity. Easy to implement
3.  Naturally splits large apps into small, manageable units (pages)
Caveats
1.  Limited interactivity
2.  Higher latency
Visualforce Page Centric Model
Lightning App-Centric Model
1.  Browser requests Component
Client Server
3.  Browser builds UI with JavaScript
4.  Browser requests data
7.  Back to 3
2.  Server returns Component Bundle
5.  Server executes Apex
6.  Server returns data (data only!)
Show different data? Back to 4
Show different view? Back to 3
Pros
•  Enables highly interactive/immersive user experiences
•  Less page refreshes
•  Tightly integrated (no iframe)
•  Composable
Caveats
•  Higher learning curve compared to vanilla Visualforce pages
•  Higher level of complexity. Building an app is generally more complex than building a page
Lightning Components App Centric Model
Creating an Aura-Enabled Apex Controller
public	
  with	
  sharing	
  class	
  AccountController	
  {	
  
	
  	
  	
  	
  @AuraEnabled	
  
	
  	
  	
  	
  public	
  static	
  List<Account>	
  findAll()	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  return	
  [SELECT	
  id,	
  name	
  FROM	
  Account];	
  
	
  	
  	
  	
  }	
  
}	
  
	
  
1.  Create an Aura-enabled Apex controller named
AccountController
2.  Add a findAll() method that returns accounts that have
location information
Challenge
Step 4:
Creating the AccountLocator
Component
Anatomy of a Lightning Component
<aura:component	
  controller="AccountController">	
  
	
  	
  	
  	
  <div>	
  
	
  	
  	
  	
  	
  	
  	
  	
  <div>AccountMap	
  goes	
  here</div>	
  
	
  	
  	
  	
  	
  	
  	
  	
  <div>AccountList	
  goes	
  here</div>	
  
	
  	
  	
  	
  </div>	
  
</aura:component>	
  
Component Parts: Component
UI Markup
Data binding
Attributes
Component	
  
Component Parts: Style
UI Markup
Data binding
Attributes
Component	
  Style	
  
Encapsulated
CSS
1.  In the Salesforce1 app
2.  In App Builder
3.  In Lightning Applications
Where can I use Lightning Components?
Using a Lightning Component in the Salesforce1 App
1.  Implement the force:appHostable interface
<aura:component	
  implements="force:appHostable">	
  
2.  Create a Tab
3.  Add the Tab to Mobile Navigation
Using a Lightning Component in a Lightning App
1.  Create a Lightning App
File > New > Lightning Application
2.  Embed the Lightning Component
<aura:application>	
  
	
  	
  	
  	
  <c:AccountLocator/>	
  
</aura:application>	
  
Useful for creating fullscreen apps or for testing components during development
1.  Create the AccountLocator component
2.  Add AccountLocator to the Salesforce1 App menu
Challenge
Step 5:
Creating the AccountList Component
Attributes
•  The data of the component
•  Available anywhere in the component
•  Examples:
<aura:attribute	
  name="price"	
  type="Number"/>	
  
<aura:attribute	
  name="title"	
  type="String"/>	
  
<aura:attribute name="account" type="Account"/>
<aura:attribute name="accounts" type="Account[]"/>
Data Binding
•  {! } notation
<aura:attribute	
  name="account"	
  type="Account"/>	
  
<li><a>{!v.account.Name}</a></li>	
  
•  Bidirectional in ui: components
<aura:attribute	
  name="price"	
  type="Number"/>	
  
<ui:inputNumber	
  label="Principal:"	
  value="{!v.price}"	
  format="#"/>	
  
Price attribute value is updated automatically when user types in input field
Component Parts: Controller
UI Markup
Data binding
Attributes
Component	
  
Event
Handlers
Controller	
  Style	
  
Encapsulated
CSS
Event Handlers
1.  Component
<aura:attribute	
  name="counter"	
  type="Number"	
  default="0"/>	
  
<ui:button	
  label="Click	
  me"	
  press="{!c.handleClick}"/>	
  
<div>{!v.counter}</div>	
  
2.  Controller
({	
  
	
  	
  	
  	
  handleClick:	
  function(component,	
  event)	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  var	
  counter	
  =	
  component.get("v.counter");	
  
	
  	
  	
  	
  	
  	
  	
  	
  counter	
  =	
  counter	
  +	
  1;	
  
	
  	
  	
  	
  	
  	
  	
  	
  component.set("v.counter",	
  counter);	
  
	
  	
  	
  	
  }	
  
})	
  
Event Handlers
<aura:attribute	
  name="accounts"	
  type="Accounts[]"/>	
  
<aura:handler	
  name="init"	
  value="{!this}"	
  action="{!c.doInit}"	
  />	
  
	
  
({	
  
	
  	
  	
  	
  doInit	
  :	
  function(component,	
  event)	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  var	
  action	
  =	
  component.get("c.findAll");	
  
	
  	
  	
  	
  	
  	
  	
  	
  action.setCallback(this,	
  function(a)	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  component.set("v.accounts",	
  a.getReturnValue());	
  
	
  	
  	
  	
  	
  	
  	
  	
  });	
  
	
  	
  	
  	
  	
  	
  	
  	
  $A.enqueueAction(action);	
  
	
  	
  	
  	
  }	
  
})	
  
Iterating through a List
<aura:attribute	
  name="accounts"	
  type="Account[]"/>	
  
<aura:handler	
  name="init"	
  value="{!this}"	
  action="{!c.doInit}"/>	
  
	
  
<ul>	
  
<aura:iteration	
  items="{!v.accounts}"	
  var="account">	
  
	
  	
  	
  	
  <li>{!account.Name}</li>	
  
</aura:iteration>	
  
</ul>	
  
Iterating through a List
<aura:attribute	
  name="accounts"	
  type="Account[]"/>	
  
<aura:handler	
  name="init"	
  value="{!this}"	
  action="{!c.doInit}"/>	
  
	
  
<ul>	
  
<aura:iteration	
  items="{!v.accounts}"	
  var="account">	
  
	
  	
  	
  	
  <c:AccountListItem	
  account="{!account}"/>	
  
</aura:iteration>	
  
</ul>	
  
AccountListItem
<aura:component>	
  
	
  	
  	
  	
  <aura:attribute	
  name="account"	
  type="Account"/>	
  
	
  	
  	
  	
  <li>{!v.account.Name}</li>	
  
</aura:component>	
  
1.  Create the AccountList component responsible for displaying
the list of accounts
2.  Create the AccountListItem component that you nest inside
AccountList to render individual accounts in the list
Challenge
Step 6:
Creating the AccountMap Component
•  External JavaScript libraries and CSS style sheets must be loaded as static
resources
•  Use the <ltng:require>	
  tag to load them
•  Loading is asynchronous
•  afterScriptLoaded event is triggered after files have been succesfully loaded
Loading External JavaScript Libraries and CSS Files
Loading External JavaScript Libraries
	
  
<ltng:require	
  scripts="/resource/leaflet/leaflet.js"/>	
  
Loading External CSS Style Sheets
	
  
<ltng:require	
  styles="/resource/leaflet/leaflet.css"	
  />	
  
Loading JavaScript Libraries and CSS Style Sheets
	
  
<ltng:require	
  	
  
	
  scripts="/resource/leaflet/leaflet.js"	
   	
  	
  
	
  styles="/resource/leaflet/leaflet.css"	
  />	
  
Using the afterScriptLoaded Event
	
  
<ltng:require	
  	
  
	
  scripts="/resource/leaflet/leaflet.js"	
   	
  	
  
	
  styles="/resource/leaflet/leaflet.css"	
  
	
  afterScriptsLoaded="{!c.renderMap}"	
  />	
  
1.  Load leaflet JS library
2.  Load Leaflet CSS
3.  Render the map when files are loaded
Challenge
Step 7:
Intercomponent Communication
Intercomponent Communication
Application Event Broker
Event Object
<aura:handler	
  event="c:AccountsLoaded"	
  
	
  	
  	
  	
  action="{!c.accountsLoadedHandler}"/>	
  	
  
<aura:registerEvent	
  name="loaded"	
  
	
  	
  	
  	
  type="c:AccountsLoaded"/>	
  
var	
  event	
  =	
  $A.get("e.c:AccountsLoaded");	
  
event.setParams({"accounts":	
  accounts});	
  
event.fire();	
  
AccountMapAccountList
Creating the AccountsLoaded Event
<aura:event	
  type="APPLICATION">	
  
	
  	
  	
  	
  <aura:attribute	
  name="accounts"	
  Type="Account[]"/>	
  
</aura:event>	
  
1.  Create the AccountsLoaded Event
2.  Trigger the AccountsLoaded Event in AccountList
3.  Handle the AccountsLoaded Event in AccountMap
Challenge
Step 8:
Using Events to Center the Map
Intercomponent Communication
Application Event Broker
Event Object
<aura:handler	
  event="c:AccountSelected"	
  
	
  	
  	
  	
  action="{!c.accountSelectedHandler}"/>	
  	
  
<aura:registerEvent	
  name="select"	
  
	
  	
  	
  	
  type="c:AccountSelected"/>	
  
var	
  event	
  =	
  $A.get("e.c:AccountSelected");	
  
event.setParams({"account":	
  account});	
  
event.fire();	
  
AccountMapAccountList
1.  Create the AccountSelected event
2.  Trigger the AccountSelected event in AccountList
3.  Handle the AccountSelected event in AccountMap and center the map on
the selected account location
Challenge
Step 9:
Interacting with the Salesforce1 App
1.  Lightning Components enable you to extend standard features
2.  Don't reinvent the wheel
For example, if your component needs an account details view: use the standard one, don't
create your own
3.  Navigation between standard features and custom components should be smooth and feel
integrated: users shouldn't notice they are switching between standard and custom features
4.  Platform events allow you to integrate your custom components into the standard experience
Salesforce1 Integration
Firing a Platform Event
var	
  event	
  =	
  $A.get("e.force:navigateToSObject");	
  
event.setParams({	
  
	
  	
  	
  	
  "recordId":	
  accountId	
  
});	
  
event.fire();	
  
	
  
This event will be handled be the Salesforce1 app which will then navigate
to the account's details view
Component Parts: Helper
UI Markup
Data binding
Attributes
Component	
  
Event
Handlers
Controller	
  
Shared
Logic
Helper	
  Style	
  
Encapsulated
CSS
When a user clicks a marker on the map, load the default
Salesforce1 details view for the selected account
Challenge
Step 10:
Using Components in App Builder
Using a Lightning Component in App Builder
1. Implement	
  the	
  flexipage:availableForAllPageTypes	
  interface	
  
<aura:component	
  implements="flexipage:availableForAllPageTypes">	
  
2. Create	
  a	
  component	
  description	
  in	
  the	
  Design	
  part	
  
<design:component	
  label="AccountList">	
  
</design:component>	
  
3. Drag	
  the	
  component	
  from	
  the	
  component	
  palette	
  in	
  App	
  Builder	
  
Compose AccountList and AccountMap in App Builder
Challenge
Summary
UI Markup
Data binding
Attributes
Component	
  
Design	
  Descriptor	
  
Event
Handlers
Controller	
  
Shared
Logic
Helper	
  Style	
  
Custom Rendering
Renderer	
  
Encapsulated
CSS
App Builder

More Related Content

What's hot

Salesforce World Tour 2016 : Lightning Out : Components on any Platform
Salesforce World Tour 2016 : Lightning Out : Components on any PlatformSalesforce World Tour 2016 : Lightning Out : Components on any Platform
Salesforce World Tour 2016 : Lightning Out : Components on any Platformandyinthecloud
 
ASP.Net Presentation Part1
ASP.Net Presentation Part1ASP.Net Presentation Part1
ASP.Net Presentation Part1Neeraj Mathur
 
Microsoft identity platform community call-May 2020
Microsoft identity platform community call-May 2020Microsoft identity platform community call-May 2020
Microsoft identity platform community call-May 2020Microsoft 365 Developer
 
Practical Headless Flow Examples
Practical Headless Flow ExamplesPractical Headless Flow Examples
Practical Headless Flow ExamplesSalesforce Admins
 
Journey from classic Salesforce development to lightning Developmemt
Journey from classic Salesforce development to lightning DevelopmemtJourney from classic Salesforce development to lightning Developmemt
Journey from classic Salesforce development to lightning DevelopmemtSunil kumar
 
O365con14 - a developer jam with yammer
O365con14 - a developer jam with yammerO365con14 - a developer jam with yammer
O365con14 - a developer jam with yammerNCCOMMS
 
03 asp.net session04
03 asp.net session0403 asp.net session04
03 asp.net session04Vivek chan
 
Advanced SharePoint Web Part Development
Advanced SharePoint Web Part DevelopmentAdvanced SharePoint Web Part Development
Advanced SharePoint Web Part DevelopmentRob Windsor
 
SharePoint 2013 “App Model” Developing and Deploying Provider Hosted Apps
SharePoint 2013 “App Model” Developing and Deploying Provider Hosted AppsSharePoint 2013 “App Model” Developing and Deploying Provider Hosted Apps
SharePoint 2013 “App Model” Developing and Deploying Provider Hosted AppsSanjay Patel
 
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...SPTechCon
 
Creating azure logic app for salesforce integration | Webner
Creating azure logic app for salesforce integration | WebnerCreating azure logic app for salesforce integration | Webner
Creating azure logic app for salesforce integration | WebnerChandanWebner
 
Apex Enterprise Patterns: Building Strong Foundations
Apex Enterprise Patterns: Building Strong FoundationsApex Enterprise Patterns: Building Strong Foundations
Apex Enterprise Patterns: Building Strong FoundationsSalesforce Developers
 
Lyudmila Zharova: Developing Solutions for SharePoint 2010 Using the Client O...
Lyudmila Zharova: Developing Solutions for SharePoint 2010 Using the Client O...Lyudmila Zharova: Developing Solutions for SharePoint 2010 Using the Client O...
Lyudmila Zharova: Developing Solutions for SharePoint 2010 Using the Client O...SharePoint Saturday NY
 
Microsoft identity platform developer community call-October 2019
Microsoft identity platform developer community call-October 2019Microsoft identity platform developer community call-October 2019
Microsoft identity platform developer community call-October 2019Microsoft 365 Developer
 
Building strong foundations apex enterprise patterns
Building strong foundations apex enterprise patternsBuilding strong foundations apex enterprise patterns
Building strong foundations apex enterprise patternsandyinthecloud
 
Salesforce Lightning Events - Hands on Training
Salesforce Lightning Events - Hands on TrainingSalesforce Lightning Events - Hands on Training
Salesforce Lightning Events - Hands on TrainingSunil kumar
 
Charla desarrollo de apps con sharepoint y office 365
Charla   desarrollo de apps con sharepoint y office 365Charla   desarrollo de apps con sharepoint y office 365
Charla desarrollo de apps con sharepoint y office 365Luis Valencia
 

What's hot (20)

Salesforce World Tour 2016 : Lightning Out : Components on any Platform
Salesforce World Tour 2016 : Lightning Out : Components on any PlatformSalesforce World Tour 2016 : Lightning Out : Components on any Platform
Salesforce World Tour 2016 : Lightning Out : Components on any Platform
 
ASP.Net Presentation Part1
ASP.Net Presentation Part1ASP.Net Presentation Part1
ASP.Net Presentation Part1
 
Microsoft identity platform community call-May 2020
Microsoft identity platform community call-May 2020Microsoft identity platform community call-May 2020
Microsoft identity platform community call-May 2020
 
Practical Headless Flow Examples
Practical Headless Flow ExamplesPractical Headless Flow Examples
Practical Headless Flow Examples
 
Journey from classic Salesforce development to lightning Developmemt
Journey from classic Salesforce development to lightning DevelopmemtJourney from classic Salesforce development to lightning Developmemt
Journey from classic Salesforce development to lightning Developmemt
 
O365con14 - a developer jam with yammer
O365con14 - a developer jam with yammerO365con14 - a developer jam with yammer
O365con14 - a developer jam with yammer
 
03 asp.net session04
03 asp.net session0403 asp.net session04
03 asp.net session04
 
Advanced SharePoint Web Part Development
Advanced SharePoint Web Part DevelopmentAdvanced SharePoint Web Part Development
Advanced SharePoint Web Part Development
 
SharePoint 2013 “App Model” Developing and Deploying Provider Hosted Apps
SharePoint 2013 “App Model” Developing and Deploying Provider Hosted AppsSharePoint 2013 “App Model” Developing and Deploying Provider Hosted Apps
SharePoint 2013 “App Model” Developing and Deploying Provider Hosted Apps
 
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
 
Creating azure logic app for salesforce integration | Webner
Creating azure logic app for salesforce integration | WebnerCreating azure logic app for salesforce integration | Webner
Creating azure logic app for salesforce integration | Webner
 
Apex Enterprise Patterns: Building Strong Foundations
Apex Enterprise Patterns: Building Strong FoundationsApex Enterprise Patterns: Building Strong Foundations
Apex Enterprise Patterns: Building Strong Foundations
 
Lyudmila Zharova: Developing Solutions for SharePoint 2010 Using the Client O...
Lyudmila Zharova: Developing Solutions for SharePoint 2010 Using the Client O...Lyudmila Zharova: Developing Solutions for SharePoint 2010 Using the Client O...
Lyudmila Zharova: Developing Solutions for SharePoint 2010 Using the Client O...
 
Microsoft identity platform developer community call-October 2019
Microsoft identity platform developer community call-October 2019Microsoft identity platform developer community call-October 2019
Microsoft identity platform developer community call-October 2019
 
Building strong foundations apex enterprise patterns
Building strong foundations apex enterprise patternsBuilding strong foundations apex enterprise patterns
Building strong foundations apex enterprise patterns
 
Salesforce Lightning Events - Hands on Training
Salesforce Lightning Events - Hands on TrainingSalesforce Lightning Events - Hands on Training
Salesforce Lightning Events - Hands on Training
 
Rits Brown Bag - TypeScript
Rits Brown Bag - TypeScriptRits Brown Bag - TypeScript
Rits Brown Bag - TypeScript
 
Charla desarrollo de apps con sharepoint y office 365
Charla   desarrollo de apps con sharepoint y office 365Charla   desarrollo de apps con sharepoint y office 365
Charla desarrollo de apps con sharepoint y office 365
 
Asp.net controls
Asp.net controlsAsp.net controls
Asp.net controls
 
Controls in asp.net
Controls in asp.netControls in asp.net
Controls in asp.net
 

Viewers also liked

Hands-On Workshop: Introduction to Coding for on Force.com for Admins and Non...
Hands-On Workshop: Introduction to Coding for on Force.com for Admins and Non...Hands-On Workshop: Introduction to Coding for on Force.com for Admins and Non...
Hands-On Workshop: Introduction to Coding for on Force.com for Admins and Non...Salesforce Developers
 
Introducing the Salesforce Lightning Design System
Introducing the Salesforce Lightning Design SystemIntroducing the Salesforce Lightning Design System
Introducing the Salesforce Lightning Design SystemSalesforce Developers
 
Salesforce Lightning Experience Overview by Brainiate
Salesforce Lightning Experience Overview by BrainiateSalesforce Lightning Experience Overview by Brainiate
Salesforce Lightning Experience Overview by Brainiatebrainiate
 
synebo talk #1 Salesforce lightning
synebo talk #1 Salesforce lightningsynebo talk #1 Salesforce lightning
synebo talk #1 Salesforce lightningAnna Kryvulya
 
What is Salesforce lighting explained
What is Salesforce lighting explainedWhat is Salesforce lighting explained
What is Salesforce lighting explainedRoy Gilad
 
Lightning Components and App Builder for admins
Lightning Components and App Builder for adminsLightning Components and App Builder for admins
Lightning Components and App Builder for adminsAlba Azcona Rivas
 
How Salesforce.com R&D Delivers the Cloud
How Salesforce.com R&D Delivers the CloudHow Salesforce.com R&D Delivers the Cloud
How Salesforce.com R&D Delivers the CloudSalesforce Developers
 
Salesforce Lightning Components
Salesforce Lightning ComponentsSalesforce Lightning Components
Salesforce Lightning ComponentsDavid Carnicer
 
Rits Brown Bag - Salesforce Lightning
Rits Brown Bag - Salesforce LightningRits Brown Bag - Salesforce Lightning
Rits Brown Bag - Salesforce LightningRight IT Services
 
How to Get Started with Salesforce Lightning
How to Get Started with Salesforce LightningHow to Get Started with Salesforce Lightning
How to Get Started with Salesforce LightningSalesforce Admins
 
Introducing: The Lightning Experience
Introducing: The Lightning ExperienceIntroducing: The Lightning Experience
Introducing: The Lightning ExperienceDreamforce
 
Salesforce Ideas Implementation Best Practices
Salesforce Ideas Implementation Best PracticesSalesforce Ideas Implementation Best Practices
Salesforce Ideas Implementation Best PracticesJamie Grenney
 
Salesforce1 app getting started guide
Salesforce1 app getting started guideSalesforce1 app getting started guide
Salesforce1 app getting started guide1stevemarcy
 
Lightning Components Introduction
Lightning Components IntroductionLightning Components Introduction
Lightning Components IntroductionDurgesh Dhoot
 
Apex basics-for Beginners
Apex basics-for BeginnersApex basics-for Beginners
Apex basics-for Beginnershrakhra
 
Lightning Components Explained
Lightning Components ExplainedLightning Components Explained
Lightning Components ExplainedAtul Gupta(8X)
 

Viewers also liked (20)

Hands-On Workshop: Introduction to Coding for on Force.com for Admins and Non...
Hands-On Workshop: Introduction to Coding for on Force.com for Admins and Non...Hands-On Workshop: Introduction to Coding for on Force.com for Admins and Non...
Hands-On Workshop: Introduction to Coding for on Force.com for Admins and Non...
 
Introducing the Salesforce Lightning Design System
Introducing the Salesforce Lightning Design SystemIntroducing the Salesforce Lightning Design System
Introducing the Salesforce Lightning Design System
 
Salesforce Lightning Experience Overview by Brainiate
Salesforce Lightning Experience Overview by BrainiateSalesforce Lightning Experience Overview by Brainiate
Salesforce Lightning Experience Overview by Brainiate
 
synebo talk #1 Salesforce lightning
synebo talk #1 Salesforce lightningsynebo talk #1 Salesforce lightning
synebo talk #1 Salesforce lightning
 
What is Salesforce lighting explained
What is Salesforce lighting explainedWhat is Salesforce lighting explained
What is Salesforce lighting explained
 
Salesforce Lightning workshop
Salesforce Lightning workshopSalesforce Lightning workshop
Salesforce Lightning workshop
 
Discover Salesforce Lightning 1
Discover Salesforce Lightning 1Discover Salesforce Lightning 1
Discover Salesforce Lightning 1
 
Lightning Components and App Builder for admins
Lightning Components and App Builder for adminsLightning Components and App Builder for admins
Lightning Components and App Builder for admins
 
How Salesforce.com R&D Delivers the Cloud
How Salesforce.com R&D Delivers the CloudHow Salesforce.com R&D Delivers the Cloud
How Salesforce.com R&D Delivers the Cloud
 
Salesforce Lightning Components
Salesforce Lightning ComponentsSalesforce Lightning Components
Salesforce Lightning Components
 
Rits Brown Bag - Salesforce Lightning
Rits Brown Bag - Salesforce LightningRits Brown Bag - Salesforce Lightning
Rits Brown Bag - Salesforce Lightning
 
How to Get Started with Salesforce Lightning
How to Get Started with Salesforce LightningHow to Get Started with Salesforce Lightning
How to Get Started with Salesforce Lightning
 
Introducing: The Lightning Experience
Introducing: The Lightning ExperienceIntroducing: The Lightning Experience
Introducing: The Lightning Experience
 
Salesforce Ideas Implementation Best Practices
Salesforce Ideas Implementation Best PracticesSalesforce Ideas Implementation Best Practices
Salesforce Ideas Implementation Best Practices
 
Salesforce1 app getting started guide
Salesforce1 app getting started guideSalesforce1 app getting started guide
Salesforce1 app getting started guide
 
Lightning Components Introduction
Lightning Components IntroductionLightning Components Introduction
Lightning Components Introduction
 
Intro to Apex Programmers
Intro to Apex ProgrammersIntro to Apex Programmers
Intro to Apex Programmers
 
Apex basics-for Beginners
Apex basics-for BeginnersApex basics-for Beginners
Apex basics-for Beginners
 
Lightning Components Explained
Lightning Components ExplainedLightning Components Explained
Lightning Components Explained
 
Salesforce Data Structures
Salesforce Data StructuresSalesforce Data Structures
Salesforce Data Structures
 

Similar to Salesforce Lightning Components Workshop

Lightning Components Workshop
Lightning Components WorkshopLightning Components Workshop
Lightning Components WorkshopGordon Bockus
 
Building a dashboard using AngularJS
Building a dashboard using AngularJSBuilding a dashboard using AngularJS
Building a dashboard using AngularJSRajthilakMCA
 
Paul Lammertsma: Account manager & sync
Paul Lammertsma: Account manager & syncPaul Lammertsma: Account manager & sync
Paul Lammertsma: Account manager & syncmdevtalk
 
Android app development basics
Android app development basicsAndroid app development basics
Android app development basicsAnton Narusberg
 
Angular - Chapter 4 - Data and Event Handling
 Angular - Chapter 4 - Data and Event Handling Angular - Chapter 4 - Data and Event Handling
Angular - Chapter 4 - Data and Event HandlingWebStackAcademy
 
Lightning salesforce
Lightning salesforceLightning salesforce
Lightning salesforcemounikadv
 
How to disassemble one monster app into an ecosystem of 30
How to disassemble one monster app into an ecosystem of 30How to disassemble one monster app into an ecosystem of 30
How to disassemble one monster app into an ecosystem of 30fiyuer
 
Lab #2: Introduction to Javascript
Lab #2: Introduction to JavascriptLab #2: Introduction to Javascript
Lab #2: Introduction to JavascriptWalid Ashraf
 
Practical Dynamic Actions - Intro
Practical Dynamic Actions - IntroPractical Dynamic Actions - Intro
Practical Dynamic Actions - IntroJorge Rimblas
 
Windows Store app using XAML and C#: Enterprise Product Development
Windows Store app using XAML and C#: Enterprise Product Development Windows Store app using XAML and C#: Enterprise Product Development
Windows Store app using XAML and C#: Enterprise Product Development Mahmoud Hamed Mahmoud
 
Office 365 api vs share point app model
Office 365 api vs share point app modelOffice 365 api vs share point app model
Office 365 api vs share point app modelBIWUG
 
Interoperable Component Patterns
Interoperable Component PatternsInteroperable Component Patterns
Interoperable Component PatternsMatthew Beale
 
Leture5 exercise onactivities
Leture5 exercise onactivitiesLeture5 exercise onactivities
Leture5 exercise onactivitiesmaamir farooq
 
Lecture exercise on activities
Lecture exercise on activitiesLecture exercise on activities
Lecture exercise on activitiesmaamir farooq
 
Oracle MAF real life OOW.pptx
Oracle MAF real life OOW.pptxOracle MAF real life OOW.pptx
Oracle MAF real life OOW.pptxLuc Bors
 
ADF and JavaScript - AMIS SIG, July 2017
ADF and JavaScript - AMIS SIG, July 2017ADF and JavaScript - AMIS SIG, July 2017
ADF and JavaScript - AMIS SIG, July 2017Lucas Jellema
 

Similar to Salesforce Lightning Components Workshop (20)

Lightning Components Workshop
Lightning Components WorkshopLightning Components Workshop
Lightning Components Workshop
 
Google app engine by example
Google app engine by exampleGoogle app engine by example
Google app engine by example
 
Chapter 10
Chapter 10Chapter 10
Chapter 10
 
Building a dashboard using AngularJS
Building a dashboard using AngularJSBuilding a dashboard using AngularJS
Building a dashboard using AngularJS
 
Paul Lammertsma: Account manager & sync
Paul Lammertsma: Account manager & syncPaul Lammertsma: Account manager & sync
Paul Lammertsma: Account manager & sync
 
Asp.net tips
Asp.net tipsAsp.net tips
Asp.net tips
 
Android app development basics
Android app development basicsAndroid app development basics
Android app development basics
 
Client Web
Client WebClient Web
Client Web
 
Angular - Chapter 4 - Data and Event Handling
 Angular - Chapter 4 - Data and Event Handling Angular - Chapter 4 - Data and Event Handling
Angular - Chapter 4 - Data and Event Handling
 
Lightning salesforce
Lightning salesforceLightning salesforce
Lightning salesforce
 
How to disassemble one monster app into an ecosystem of 30
How to disassemble one monster app into an ecosystem of 30How to disassemble one monster app into an ecosystem of 30
How to disassemble one monster app into an ecosystem of 30
 
Lab #2: Introduction to Javascript
Lab #2: Introduction to JavascriptLab #2: Introduction to Javascript
Lab #2: Introduction to Javascript
 
Practical Dynamic Actions - Intro
Practical Dynamic Actions - IntroPractical Dynamic Actions - Intro
Practical Dynamic Actions - Intro
 
Windows Store app using XAML and C#: Enterprise Product Development
Windows Store app using XAML and C#: Enterprise Product Development Windows Store app using XAML and C#: Enterprise Product Development
Windows Store app using XAML and C#: Enterprise Product Development
 
Office 365 api vs share point app model
Office 365 api vs share point app modelOffice 365 api vs share point app model
Office 365 api vs share point app model
 
Interoperable Component Patterns
Interoperable Component PatternsInteroperable Component Patterns
Interoperable Component Patterns
 
Leture5 exercise onactivities
Leture5 exercise onactivitiesLeture5 exercise onactivities
Leture5 exercise onactivities
 
Lecture exercise on activities
Lecture exercise on activitiesLecture exercise on activities
Lecture exercise on activities
 
Oracle MAF real life OOW.pptx
Oracle MAF real life OOW.pptxOracle MAF real life OOW.pptx
Oracle MAF real life OOW.pptx
 
ADF and JavaScript - AMIS SIG, July 2017
ADF and JavaScript - AMIS SIG, July 2017ADF and JavaScript - AMIS SIG, July 2017
ADF and JavaScript - AMIS SIG, July 2017
 

Recently uploaded

Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 

Recently uploaded (20)

Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 

Salesforce Lightning Components Workshop

  • 1. Building Lightning Components ​ Christophe Coenraets ​ Developer Evangelist ​ Salesforce DUG NYC ​ 11/11/2015 ​  ​ #TrailheadLive ​ @ccoenraets
  • 3. Step 1: Setting Up Your Environment
  • 4. 1.  Sign up for a Developer Edition Org 2.  Enable Lightning Components Challenge
  • 6. 1.  Add a geolocation field to the Account object 2.  Enter sample data Challenge
  • 7. Step 3: Creating an Aura-Enabled Controller
  • 8. Visualforce Page-Centric Model 1.  Browser requests page Client Server 4.  Browser renders html 2.  Server executes Apex code 3.  Server returns page (html + data) Show different data? Back to 1 Show different view? Back to 1
  • 9. Pros 1.  Proven model 2.  Productivity. Easy to implement 3.  Naturally splits large apps into small, manageable units (pages) Caveats 1.  Limited interactivity 2.  Higher latency Visualforce Page Centric Model
  • 10. Lightning App-Centric Model 1.  Browser requests Component Client Server 3.  Browser builds UI with JavaScript 4.  Browser requests data 7.  Back to 3 2.  Server returns Component Bundle 5.  Server executes Apex 6.  Server returns data (data only!) Show different data? Back to 4 Show different view? Back to 3
  • 11. Pros •  Enables highly interactive/immersive user experiences •  Less page refreshes •  Tightly integrated (no iframe) •  Composable Caveats •  Higher learning curve compared to vanilla Visualforce pages •  Higher level of complexity. Building an app is generally more complex than building a page Lightning Components App Centric Model
  • 12. Creating an Aura-Enabled Apex Controller public  with  sharing  class  AccountController  {          @AuraEnabled          public  static  List<Account>  findAll()  {                  return  [SELECT  id,  name  FROM  Account];          }   }    
  • 13. 1.  Create an Aura-enabled Apex controller named AccountController 2.  Add a findAll() method that returns accounts that have location information Challenge
  • 14. Step 4: Creating the AccountLocator Component
  • 15. Anatomy of a Lightning Component <aura:component  controller="AccountController">          <div>                  <div>AccountMap  goes  here</div>                  <div>AccountList  goes  here</div>          </div>   </aura:component>  
  • 16. Component Parts: Component UI Markup Data binding Attributes Component  
  • 17. Component Parts: Style UI Markup Data binding Attributes Component  Style   Encapsulated CSS
  • 18. 1.  In the Salesforce1 app 2.  In App Builder 3.  In Lightning Applications Where can I use Lightning Components?
  • 19. Using a Lightning Component in the Salesforce1 App 1.  Implement the force:appHostable interface <aura:component  implements="force:appHostable">   2.  Create a Tab 3.  Add the Tab to Mobile Navigation
  • 20. Using a Lightning Component in a Lightning App 1.  Create a Lightning App File > New > Lightning Application 2.  Embed the Lightning Component <aura:application>          <c:AccountLocator/>   </aura:application>   Useful for creating fullscreen apps or for testing components during development
  • 21. 1.  Create the AccountLocator component 2.  Add AccountLocator to the Salesforce1 App menu Challenge
  • 22. Step 5: Creating the AccountList Component
  • 23. Attributes •  The data of the component •  Available anywhere in the component •  Examples: <aura:attribute  name="price"  type="Number"/>   <aura:attribute  name="title"  type="String"/>   <aura:attribute name="account" type="Account"/> <aura:attribute name="accounts" type="Account[]"/>
  • 24. Data Binding •  {! } notation <aura:attribute  name="account"  type="Account"/>   <li><a>{!v.account.Name}</a></li>   •  Bidirectional in ui: components <aura:attribute  name="price"  type="Number"/>   <ui:inputNumber  label="Principal:"  value="{!v.price}"  format="#"/>   Price attribute value is updated automatically when user types in input field
  • 25. Component Parts: Controller UI Markup Data binding Attributes Component   Event Handlers Controller  Style   Encapsulated CSS
  • 26. Event Handlers 1.  Component <aura:attribute  name="counter"  type="Number"  default="0"/>   <ui:button  label="Click  me"  press="{!c.handleClick}"/>   <div>{!v.counter}</div>   2.  Controller ({          handleClick:  function(component,  event)  {                  var  counter  =  component.get("v.counter");                  counter  =  counter  +  1;                  component.set("v.counter",  counter);          }   })  
  • 27. Event Handlers <aura:attribute  name="accounts"  type="Accounts[]"/>   <aura:handler  name="init"  value="{!this}"  action="{!c.doInit}"  />     ({          doInit  :  function(component,  event)  {                  var  action  =  component.get("c.findAll");                  action.setCallback(this,  function(a)  {                          component.set("v.accounts",  a.getReturnValue());                  });                  $A.enqueueAction(action);          }   })  
  • 28. Iterating through a List <aura:attribute  name="accounts"  type="Account[]"/>   <aura:handler  name="init"  value="{!this}"  action="{!c.doInit}"/>     <ul>   <aura:iteration  items="{!v.accounts}"  var="account">          <li>{!account.Name}</li>   </aura:iteration>   </ul>  
  • 29. Iterating through a List <aura:attribute  name="accounts"  type="Account[]"/>   <aura:handler  name="init"  value="{!this}"  action="{!c.doInit}"/>     <ul>   <aura:iteration  items="{!v.accounts}"  var="account">          <c:AccountListItem  account="{!account}"/>   </aura:iteration>   </ul>  
  • 30. AccountListItem <aura:component>          <aura:attribute  name="account"  type="Account"/>          <li>{!v.account.Name}</li>   </aura:component>  
  • 31. 1.  Create the AccountList component responsible for displaying the list of accounts 2.  Create the AccountListItem component that you nest inside AccountList to render individual accounts in the list Challenge
  • 32. Step 6: Creating the AccountMap Component
  • 33. •  External JavaScript libraries and CSS style sheets must be loaded as static resources •  Use the <ltng:require>  tag to load them •  Loading is asynchronous •  afterScriptLoaded event is triggered after files have been succesfully loaded Loading External JavaScript Libraries and CSS Files
  • 34. Loading External JavaScript Libraries   <ltng:require  scripts="/resource/leaflet/leaflet.js"/>  
  • 35. Loading External CSS Style Sheets   <ltng:require  styles="/resource/leaflet/leaflet.css"  />  
  • 36. Loading JavaScript Libraries and CSS Style Sheets   <ltng:require      scripts="/resource/leaflet/leaflet.js"        styles="/resource/leaflet/leaflet.css"  />  
  • 37. Using the afterScriptLoaded Event   <ltng:require      scripts="/resource/leaflet/leaflet.js"        styles="/resource/leaflet/leaflet.css"    afterScriptsLoaded="{!c.renderMap}"  />  
  • 38. 1.  Load leaflet JS library 2.  Load Leaflet CSS 3.  Render the map when files are loaded Challenge
  • 40. Intercomponent Communication Application Event Broker Event Object <aura:handler  event="c:AccountsLoaded"          action="{!c.accountsLoadedHandler}"/>     <aura:registerEvent  name="loaded"          type="c:AccountsLoaded"/>   var  event  =  $A.get("e.c:AccountsLoaded");   event.setParams({"accounts":  accounts});   event.fire();   AccountMapAccountList
  • 41. Creating the AccountsLoaded Event <aura:event  type="APPLICATION">          <aura:attribute  name="accounts"  Type="Account[]"/>   </aura:event>  
  • 42. 1.  Create the AccountsLoaded Event 2.  Trigger the AccountsLoaded Event in AccountList 3.  Handle the AccountsLoaded Event in AccountMap Challenge
  • 43. Step 8: Using Events to Center the Map
  • 44. Intercomponent Communication Application Event Broker Event Object <aura:handler  event="c:AccountSelected"          action="{!c.accountSelectedHandler}"/>     <aura:registerEvent  name="select"          type="c:AccountSelected"/>   var  event  =  $A.get("e.c:AccountSelected");   event.setParams({"account":  account});   event.fire();   AccountMapAccountList
  • 45. 1.  Create the AccountSelected event 2.  Trigger the AccountSelected event in AccountList 3.  Handle the AccountSelected event in AccountMap and center the map on the selected account location Challenge
  • 46. Step 9: Interacting with the Salesforce1 App
  • 47. 1.  Lightning Components enable you to extend standard features 2.  Don't reinvent the wheel For example, if your component needs an account details view: use the standard one, don't create your own 3.  Navigation between standard features and custom components should be smooth and feel integrated: users shouldn't notice they are switching between standard and custom features 4.  Platform events allow you to integrate your custom components into the standard experience Salesforce1 Integration
  • 48. Firing a Platform Event var  event  =  $A.get("e.force:navigateToSObject");   event.setParams({          "recordId":  accountId   });   event.fire();     This event will be handled be the Salesforce1 app which will then navigate to the account's details view
  • 49. Component Parts: Helper UI Markup Data binding Attributes Component   Event Handlers Controller   Shared Logic Helper  Style   Encapsulated CSS
  • 50. When a user clicks a marker on the map, load the default Salesforce1 details view for the selected account Challenge
  • 51. Step 10: Using Components in App Builder
  • 52. Using a Lightning Component in App Builder 1. Implement  the  flexipage:availableForAllPageTypes  interface   <aura:component  implements="flexipage:availableForAllPageTypes">   2. Create  a  component  description  in  the  Design  part   <design:component  label="AccountList">   </design:component>   3. Drag  the  component  from  the  component  palette  in  App  Builder  
  • 53. Compose AccountList and AccountMap in App Builder Challenge
  • 54. Summary UI Markup Data binding Attributes Component   Design  Descriptor   Event Handlers Controller   Shared Logic Helper  Style   Custom Rendering Renderer   Encapsulated CSS App Builder