19
Building a web application with Google Places & Lightning Connect Alba Azcona Rivas Technical Lead at FinancialForce.com [email protected] @Alba_ARivas

Building a web application with Google Places and Lighning Connect

Embed Size (px)

Citation preview

Page 1: Building a web application with Google Places and Lighning Connect

Building a web application with Google Places & Lightning Connect

Alba Azcona Rivas Technical Lead at [email protected] @Alba_ARivas

Page 2: Building a web application with Google Places and Lighning Connect

GREAT ALONE. BETTER TOGETHER. Native to Salesforce1™ Platform since 2009

Investors include Salesforce Ventures

650+ employees, San Francisco based

2

Page 3: Building a web application with Google Places and Lighning Connect

Why I have done this application and what is for

Demo of the application

Architecture and code of the application

Q&A

Outline

Page 4: Building a web application with Google Places and Lighning Connect

How can I learn Lightning Connect?

Well, I could build a kind of web application which needs real-time information from an external datasource on-demand…

… and which can leverage the capability of a SaaS platform as Salesforce …

Learning Lightning Connect …

Page 5: Building a web application with Google Places and Lighning Connect

Building a web application: FoodAffinity

Voting system & affinity algorithm

Eating places Lightning Connect

Page 6: Building a web application with Google Places and Lighning Connect

Demo

Page 7: Building a web application with Google Places and Lighning Connect

Application flow

Visualforce Page

Js

BackendAPEX logic

VF controller

Vote__c

Google Places

API

Lightning Connect Custom AdapterSOQL

List<Restaurant__x>

REST Http request

json

getDetail

orderByPopularity

orderByAffinity

vote

Custom object

Restaurant__x

External object

External Lookup

getByDistance

Page 8: Building a web application with Google Places and Lighning Connect

Creating a custom adapter for reading a external object

Visualforce Page

Js

Vote__c

Google Places

API

Lightning Connect Custom AdapterSOQL

List<Restaurant__x>

REST Http request

json

getByDistance

orderByPopularity

orderByAffinity

vote

Custom object

Restaurant__x

External object

External Lookup

getDetailBackend

APEX logic

VF controller

Page 9: Building a web application with Google Places and Lighning Connect

External datasource with custom adapter Datasource.Provider

Datasource.Connection

External object definition: Restaurant__x

Creating a custom adapter for reading a external object

Page 10: Building a web application with Google Places and Lighning Connect

Translating SOQL queries in REST requests

Visualforce Page

Js

Vote__c

Google Places

API

Lightning Connect Custom AdapterSOQL

List<Restaurant__x>

REST Http request

json

getByDistance

orderByPopularityorderByAffinity

vote

Custom object

Restaurant__x

External object

External Lookup

getDetailBackend

APEX logic

VF controller

Page 11: Building a web application with Google Places and Lighning Connect

Overriding query method tableSelected

columnsSelected

filter

Order

getByDistance: SELECT … FROM Restaurant__x WHERE Latitude__c = ‘…..’ AND Longitude__c = ‘…..’;

getDetail: SELECT … FROM Restaurant__x WHERE ExternalId = ‘…..’;

Translating SOQL queries in REST requests

Page 12: Building a web application with Google Places and Lighning Connect

Performing REST requests and parsing JSON response

Visualforce Page

Js

Vote__c

Google Places

API

Lightning Connect Custom AdapterSOQL

List<Restaurant__x>

REST Http request

json

getByDistance

orderByPopularityorderByAffinity

vote

Custom object

Restaurant__x

External object

External Lookup

getDetailBackend

APEX logic

VF controller

Page 13: Building a web application with Google Places and Lighning Connect

HttpRequest

{

"place_id" : "ChIJyWEHuEmuEapTCrk",

"types" : ["restaurant","food"],

"vicinity" : "King Street Wharf 23,

Sydney",

"photos" : […]

}

Showing restaurant object

in a Visualforce component

Performing REST requests and parsing JSON response

Page 14: Building a web application with Google Places and Lighning Connect

Voting & Recommendation system: Apex

Visualforce Page

Js

Vote__c

Google Places

API

Lightning Connect Custom AdapterSOQL

List<Restaurant__x>

REST Http request

json

getByDistance

orderByPopularityorderByAffinity

vote

Custom object

Restaurant__x

External object

External Lookup

getDetailBackend

APEX logic

VF controller

Page 15: Building a web application with Google Places and Lighning Connect

Vote object

Order by Popularity: overall rating calculated on load

Order by Affinity Look for the best affinity user:

Look for users who have voted the restaurants I have voted sometime

Competition: for each restaurant: Same rating: +3 points

+1/-1 rating: +1 point

Take winner user and order near restaurants according to his preferences

Voting & Recommendation system: Apex

Page 16: Building a web application with Google Places and Lighning Connect

Self-registration: 10 licenses for today!! Run!

http://doiop.com/foodaffinity

Authenticated website through Communities

Page 17: Building a web application with Google Places and Lighning Connect

https://github.com/aazcona/foodaffinity

Github repo

Page 18: Building a web application with Google Places and Lighning Connect

Q & A

Alba Azcona Rivas Technical Lead at [email protected] @Alba_ARivas

Page 19: Building a web application with Google Places and Lighning Connect

Thank You

Alba Azcona Rivas Technical Lead at FinancialForce.com

[email protected] @Alba_ARivas

Remember to tell us what you think in the event survey www.LondonsCalling.net/survey/