20
Building a Single Page App with Lightning Components March 15, 2017

Building a Single Page App with Lightning Components

Embed Size (px)

Citation preview

Page 1: Building a Single Page App with Lightning Components

Building a Single Page App with Lightning ComponentsMarch 15, 2017

Page 2: Building a Single Page App with Lightning Components

Statement under the Private Securities Litigation Reform Act of 1995:

This presentation may contain forward-looking statements that involve risks, uncertainties, and assumptions. If any such uncertainties materialize or if any of the assumptions proves incorrect, the results of salesforce.com, inc. could differ materially from the results expressed or implied by the forward-looking statements we make. All statements other than statements of historical fact could be deemed forward-looking, including any projections of product or service availability, subscriber growth, earnings, revenues, or other financial items and any statements regarding strategies or plans of management for future operations, statements of belief, any statements concerning new, planned, or upgraded services or technology developments and customer contracts or use of our services.

The risks and uncertainties referred to above include – but are not limited to – risks associated with developing and delivering new functionality for our service, new products and services, our new business model, our past operating losses, possible fluctuations in our operating results and rate of growth, interruptions or delays in our Web hosting, breach of our security measures, the outcome of any litigation, risks associated with completed and any possible mergers and acquisitions, the immature market in which we operate, our relatively limited operating history, our ability to expand, retain, and motivate our employees and manage our growth, new releases of our service and successful customer deployment, our limited history reselling non-salesforce.com products, and utilization and selling to larger enterprise customers. Further information on potential factors that could affect the financial results of salesforce.com, inc. is included in our annual report on Form 10-K for the most recent fiscal year and in our quarterly report on Form 10-Q for the most recent fiscal quarter. These documents and others containing important disclosures are available on the SEC Filings section of the Investor Information section of our Web site.

Any unreleased services or features referenced in this or other presentations, press releases or public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make the purchase decisions based upon features that are currently available. Salesforce.com, inc. assumes no obligation and does not intend to update these forward-looking statements.

Forward-Looking Statement

Page 3: Building a Single Page App with Lightning Components

Go Social!

@salesforcedevs

Salesforce Developers

Salesforce Developers

Salesforce Developers

This webinar is being recorded! The video will be posted to YouTube and thewebinar recap page (same URL as registration).

Page 4: Building a Single Page App with Lightning Components

Have Questions?• Don’t wait until the end to ask your question!

— Technical support will answer questions starting now.

• Stick around for live Q&A at the end — Speakers will tackle more questions at the end, time-

allowing. • Head to Developer Forums

— More questions? Visit developer.salesforce.com/forums ?

Page 5: Building a Single Page App with Lightning Components

Agenda

1. Intro: SendOffer LC2. Single-Page Application (SPA)3. Lightning Base Components4. Lightning Events & CSS5. Dynamic creation of Lightning Components6. Demo7. Resources

Page 6: Building a Single Page App with Lightning Components

SendOffer Lightning Component

1. We built a Recruitment Application that handles candidates, interviews, and offers.

2. SendOffer LC provides an easy way to construct and send offer letter to candidate

3. 4 Stages: Detail, Edit, Review, Send

Page 7: Building a Single Page App with Lightning Components

Single Page Application (SPA)

1. Does not require page reloads to work

2. Faster than Page-Centric Apps

3. Usually built with Javascript, CSS, Ajax

4. Examples: Salesforce Lightning Experience, Salesforce 1

Page 8: Building a Single Page App with Lightning Components

Send Offer LC (SPA)

OfferLetterSPA.cmp

Page 9: Building a Single Page App with Lightning Components

Lightning Base Components

1. Built in on the platform- No more html + SLDS + javascript work

2. Lightning:Input

3. Lightning:Select

4. Lightning:Icon

5. Lightning:TextArea

6. Lightning:button

Page 10: Building a Single Page App with Lightning Components

Lightning Events & CSS

1. Application Events

- passing data between children

2. Component Events & CSS

- bubbling - show and hide children Components

Page 11: Building a Single Page App with Lightning Components

Dynamic Creation of LCs

1. Gives you more flexibility

2. Define which child LCs and which attributes should be

created based on - data (eg. list row should show as read-only or not)- user interaction (eg. add error messages

dynamically based on validation checks)

Page 12: Building a Single Page App with Lightning Components

Demo

Page 13: Building a Single Page App with Lightning Components

OfferLetterSPA.cmp (Parent)

OfferDetails.cmpOfferTemplate.cmp

Component Events

Offer_Details_N

ext

Offer_Template_

Next

OfferPreview.cmp

Page 14: Building a Single Page App with Lightning Components

Application Events

OfferTemplate (child 2)

OfferPreview (child 3)

OfferDetails (child 1)

OfferConfirm (child 4)

OrgCandidateDetailEvent.evt———————————

• CandidateID• E-Mail• Salary• Bonus• TemplateID• OfferId• OfferLetter

CandidateDetailEvent.evt———————————

• CandidateID• E-Mail• Salary• Bonus• TemplateID• OfferId• OfferLetter

LightningFramework

LightningFramework

CandidateDetailEvent.evt———————————

• CandidateID• E-Mail• Salary• Bonus• TemplateID• OfferId• OfferLetter

CandidateDetailEvent.evt———————————

• CandidateID• E-Mail• Salary• Bonus• TemplateID• OfferId• OfferLetter

Org

Page 15: Building a Single Page App with Lightning Components

Dynamic Creation of LCs

List.cmpListController.js

<apex:Component>

<div>

{!v.Body}

</div>

</apex:Component>

// JS Controller:

//Loop

for (i = 0; i < list.length; i++) { if (i.isReadOnly){

// Create Row Component without Edit Link

} else

// Create Row Component with Edit Link}

Page 17: Building a Single Page App with Lightning Components

#forcewebinar

Deploying Your Code

Page 18: Building a Single Page App with Lightning Components

SurveyYour feedback is crucial to the successof our webinar programs. Thank you!

https://sfdc.co/singlepagelightning

Page 19: Building a Single Page App with Lightning Components

Q&ATry Trailhead: trailhead.salesforce.comJoin the conversation: @salesforcedevs

Page 20: Building a Single Page App with Lightning Components

Thank You