Building a web application with Google Places and Lighning Connect

Preview:

Citation preview

Building a web application with Google Places & Lightning Connect

Alba Azcona Rivas Technical Lead at FinancialForce.comalba.azconarivas@gmail.com @Alba_ARivas

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

Investors include Salesforce Ventures

650+ employees, San Francisco based

2

Why I have done this application and what is for

Demo of the application

Architecture and code of the application

Q&A

Outline

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 …

Building a web application: FoodAffinity

Voting system & affinity algorithm

Eating places Lightning Connect

Demo

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

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

External datasource with custom adapter Datasource.Provider

Datasource.Connection

External object definition: Restaurant__x

Creating a custom adapter for reading a external object

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

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

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

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

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

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

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

http://doiop.com/foodaffinity

Authenticated website through Communities

https://github.com/aazcona/foodaffinity

Github repo

Q & A

Alba Azcona Rivas Technical Lead at FinancialForce.comalba.azconarivas@gmail.com @Alba_ARivas

Thank You

Alba Azcona Rivas Technical Lead at FinancialForce.com

alba.azconarivas@gmail.com @Alba_ARivas

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

Recommended