SlideShare a Scribd company logo
1 of 28
Download to read offline
Developing Offline Mobile Apps
Salesforce Mobile SDK SmartStore
Tom Gersic, Salesforce.com
Director, Mobile Services Delivery
@tomgersic
Safe harbor
Safe harbor 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.
Tom Gersic
Director, Mobile Services Delivery
@tomgersic
Agenda
What we are going to build today
Salesforce Mobile SDK Overview
SmartStore Terminology
SmartSync
Walking through some code
Why Offline?
Why offline?
Data based decisions, in the field, and by the field
What we’ll build today

https://github.com/tomgersic/Opportune
Salesforce.com Mobile SDK

Customer
Data
Three Options: Which One Is Right For You?
Advanced UI interactions
Fastest performance
App store distribution

Web developer skills
Access to native platform
App store distribution

Web developer skills
Instant updates
Unrestricted distribution
I swear this makes sense!
Terminology
Soups
• Hold Indexed JSON Documents
• JSON Responses can encompass data from multiple tables

Id

Soup

Created

lastModified

Index 1

Index 2

Index N…

1

{JSON}

1371069899796

1371070436125

a00E0000009Xj2mIAC

Salesforce.
com

…

2

{JSON}

1371069899802

1371070436126

a00E0000009Xj36IAC

Facebook

…

3

{JSON}

1371069899803

1371129103154

a00E0000004h2MnIAI

Google

…
REST API Returns a JSON Response
/services/data/v28.0/query/?q=SELECT Id, Name FROM Opportunity
Stores
Some things you can do with your soup…
• Register a Soup with an IndexSpec
• Query a Soup using a QuerySpec
• Upsert Data to a Soup
• Delete Data from a Soup
• Remove a Soup
IndexSpec
• JSON Object
• Fields to index
• “string” or “integer”
[
{"path":"Id","type":"string"},
{"path":"Name","type":"string"}
]
QuerySpec
buildAllQuerySpec(path,order,pageSize)
Query all records from the object in the given sort order (or null order)
buildExactQuerySpec(path,matchKey,pageSize)
Search for records with index path values matching the key.
buildRangeQuerySpec(path,beginKey,endKey,pageSize)
Return all records with an index path value between the two range values
buildLikeQuerySpec(path,likeKey,order,pageSize)
Basically “select * from [table] LIKE ‘%[likeKey]%’”
buildSmartQuerySpec(smartSql,pageSize)
Basically “select * from [table] LIKE ‘%[likeKey]%’”
SmartSQL
SELECT {departments:name}, {employees:lastName}
FROM {employees}, {departments}
WHERE {departments:deptCode} = {employees:deptCode}
ORDER by {departments:name}, {employees:lastName}
SmartSync
SmartSync
• Extends Backbone.js
• Can be used with or without a SmartStore Cache
• Queries returned as Backbone Model Collections
Backbone

• MV* Framework
• Models: Individual records
• Collections: Collections of Model records

• View: Javascript backing for the stuff that you see
• Router: routes everything after the # in a URL to application functions
• http://myapp.com/#/user/list
Force.SObject
• sobjectType: Account, Opportunity, etc.
• fieldlist: ["Id", "Name", "Amount", "StageName"]
• cacheMode: client, server write order
• mergeMode: how to handle conflicts
• cache: if using SmartStore
• cacheForOriginals: for conflict detection
Force.StoreCache
new Force.StoreCache(soupName [, additionalIndexSpecs, keyField])
▪

__locally_created__

▪

__locally_updated__

▪

__locally_deleted__

▪

__local__ (set to true if any of the previous three are true)
Patterns for Offline Success
Offline Queueing
Tom Gersic
Director, Mobile Services Delivery
@tomgersic
@tomgersic

More Related Content

What's hot

What's hot (20)

Model Driven PowerApps
Model Driven PowerAppsModel Driven PowerApps
Model Driven PowerApps
 
Architect day 20181128 - Afternoon Session
Architect day 20181128 - Afternoon SessionArchitect day 20181128 - Afternoon Session
Architect day 20181128 - Afternoon Session
 
Salesforce Marketing Cloud Training | Salesforce Training For Beginners - Mar...
Salesforce Marketing Cloud Training | Salesforce Training For Beginners - Mar...Salesforce Marketing Cloud Training | Salesforce Training For Beginners - Mar...
Salesforce Marketing Cloud Training | Salesforce Training For Beginners - Mar...
 
Getting started with Marketing Cloud
Getting started with Marketing CloudGetting started with Marketing Cloud
Getting started with Marketing Cloud
 
Simplify your code with Salesforce DX and module development
Simplify your code with Salesforce DX and module developmentSimplify your code with Salesforce DX and module development
Simplify your code with Salesforce DX and module development
 
Salesforce Service Cloud
Salesforce Service CloudSalesforce Service Cloud
Salesforce Service Cloud
 
Ivan Gubynskyy Salesforce CRM and Platform Overview
Ivan Gubynskyy Salesforce CRM and Platform OverviewIvan Gubynskyy Salesforce CRM and Platform Overview
Ivan Gubynskyy Salesforce CRM and Platform Overview
 
Commerce Cloud 101
Commerce Cloud 101Commerce Cloud 101
Commerce Cloud 101
 
SLDS and Lightning Components
SLDS and Lightning ComponentsSLDS and Lightning Components
SLDS and Lightning Components
 
Salesforce Service cloud 3 presentation
Salesforce Service cloud 3 presentation Salesforce Service cloud 3 presentation
Salesforce Service cloud 3 presentation
 
Modern Development with Salesforce DX
Modern Development with Salesforce DXModern Development with Salesforce DX
Modern Development with Salesforce DX
 
Introduction to soa suite 12c in 20 slides
Introduction to soa suite 12c in 20 slidesIntroduction to soa suite 12c in 20 slides
Introduction to soa suite 12c in 20 slides
 
Understanding the Salesforce Architecture: How We Do the Magic We Do
Understanding the Salesforce Architecture: How We Do the Magic We DoUnderstanding the Salesforce Architecture: How We Do the Magic We Do
Understanding the Salesforce Architecture: How We Do the Magic We Do
 
Using Apex for REST Integration
Using Apex for REST IntegrationUsing Apex for REST Integration
Using Apex for REST Integration
 
Salesforce Consulting Services
Salesforce Consulting ServicesSalesforce Consulting Services
Salesforce Consulting Services
 
Salesforce complete overview
Salesforce complete overviewSalesforce complete overview
Salesforce complete overview
 
Introduction to Microsoft Power Platform (PowerApps, Flow)
Introduction to Microsoft Power Platform (PowerApps, Flow)Introduction to Microsoft Power Platform (PowerApps, Flow)
Introduction to Microsoft Power Platform (PowerApps, Flow)
 
Introduction to the Salesforce Security Model
Introduction to the Salesforce Security ModelIntroduction to the Salesforce Security Model
Introduction to the Salesforce Security Model
 
Tci reference architecture_v2.0
Tci reference architecture_v2.0Tci reference architecture_v2.0
Tci reference architecture_v2.0
 
Salesforce overview
Salesforce overviewSalesforce overview
Salesforce overview
 

Similar to Developing Offline Mobile Apps With Salesforce Mobile SDK SmartStore

Developing Offline-Capable Apps with the Salesforce Mobile SDK and SmartStore
Developing Offline-Capable Apps with the Salesforce Mobile SDK and SmartStoreDeveloping Offline-Capable Apps with the Salesforce Mobile SDK and SmartStore
Developing Offline-Capable Apps with the Salesforce Mobile SDK and SmartStore
Salesforce Developers
 

Similar to Developing Offline Mobile Apps With Salesforce Mobile SDK SmartStore (20)

Developing Offline Mobile Apps with the Salesforce.com Mobile SDK SmartStore,...
Developing Offline Mobile Apps with the Salesforce.com Mobile SDK SmartStore,...Developing Offline Mobile Apps with the Salesforce.com Mobile SDK SmartStore,...
Developing Offline Mobile Apps with the Salesforce.com Mobile SDK SmartStore,...
 
Building Apps for the ExactTarget Marketing Cloud
Building Apps for the ExactTarget Marketing CloudBuilding Apps for the ExactTarget Marketing Cloud
Building Apps for the ExactTarget Marketing Cloud
 
Developing Offline Mobile Apps with Salesforce Mobile SDK SmartStore
Developing Offline Mobile Apps with Salesforce Mobile SDK SmartStoreDeveloping Offline Mobile Apps with Salesforce Mobile SDK SmartStore
Developing Offline Mobile Apps with Salesforce Mobile SDK SmartStore
 
Lightning Component Framework from 0 to App
Lightning Component Framework from 0 to AppLightning Component Framework from 0 to App
Lightning Component Framework from 0 to App
 
Building Mobile Apps That Deliver Salesforce to Your Employees
Building Mobile Apps That Deliver Salesforce to Your EmployeesBuilding Mobile Apps That Deliver Salesforce to Your Employees
Building Mobile Apps That Deliver Salesforce to Your Employees
 
How We Built AppExchange and our Communities on the App Cloud (Platform)
How We Built AppExchange and our Communities on the App Cloud (Platform)How We Built AppExchange and our Communities on the App Cloud (Platform)
How We Built AppExchange and our Communities on the App Cloud (Platform)
 
Navi Mumbai Salesforce DUG meetup on integration
Navi Mumbai Salesforce DUG meetup on integrationNavi Mumbai Salesforce DUG meetup on integration
Navi Mumbai Salesforce DUG meetup on integration
 
Using Apache Spark for Intelligent Services: Keynote at Spark Summit East by ...
Using Apache Spark for Intelligent Services: Keynote at Spark Summit East by ...Using Apache Spark for Intelligent Services: Keynote at Spark Summit East by ...
Using Apache Spark for Intelligent Services: Keynote at Spark Summit East by ...
 
Developer Tour on the Salesforce1 Platform
Developer Tour on the Salesforce1 PlatformDeveloper Tour on the Salesforce1 Platform
Developer Tour on the Salesforce1 Platform
 
Salesforce Integration
Salesforce IntegrationSalesforce Integration
Salesforce Integration
 
Developers guide to the Salesforce1 Platform
Developers guide to the Salesforce1 PlatformDevelopers guide to the Salesforce1 Platform
Developers guide to the Salesforce1 Platform
 
TrailheaDX Global Gathering London 2018
TrailheaDX Global Gathering London 2018TrailheaDX Global Gathering London 2018
TrailheaDX Global Gathering London 2018
 
Salesforce IoT - Using low code orchestrations to achieve immediate results
Salesforce IoT - Using low code orchestrations to achieve immediate resultsSalesforce IoT - Using low code orchestrations to achieve immediate results
Salesforce IoT - Using low code orchestrations to achieve immediate results
 
Developing on the Salesforce Platform With Clicks, Not Code
Developing on the Salesforce Platform With Clicks, Not CodeDeveloping on the Salesforce Platform With Clicks, Not Code
Developing on the Salesforce Platform With Clicks, Not Code
 
Salesforce Tour Paris - Platform Events - Martin Lezer
Salesforce Tour Paris - Platform Events - Martin LezerSalesforce Tour Paris - Platform Events - Martin Lezer
Salesforce Tour Paris - Platform Events - Martin Lezer
 
Tour of Heroku + Salesforce Integration Methods
Tour of Heroku + Salesforce Integration MethodsTour of Heroku + Salesforce Integration Methods
Tour of Heroku + Salesforce Integration Methods
 
#DF17Recap series: Integrate apps easier with the Salesforce platform
#DF17Recap series: Integrate apps easier with the Salesforce platform#DF17Recap series: Integrate apps easier with the Salesforce platform
#DF17Recap series: Integrate apps easier with the Salesforce platform
 
Introduction to Data.com APIs
Introduction to Data.com APIsIntroduction to Data.com APIs
Introduction to Data.com APIs
 
Force.com Friday : Intro to Apex
Force.com Friday : Intro to Apex Force.com Friday : Intro to Apex
Force.com Friday : Intro to Apex
 
Developing Offline-Capable Apps with the Salesforce Mobile SDK and SmartStore
Developing Offline-Capable Apps with the Salesforce Mobile SDK and SmartStoreDeveloping Offline-Capable Apps with the Salesforce Mobile SDK and SmartStore
Developing Offline-Capable Apps with the Salesforce Mobile SDK and SmartStore
 

More from Salesforce Developers

More from Salesforce Developers (20)

Sample Gallery: Reference Code and Best Practices for Salesforce Developers
Sample Gallery: Reference Code and Best Practices for Salesforce DevelopersSample Gallery: Reference Code and Best Practices for Salesforce Developers
Sample Gallery: Reference Code and Best Practices for Salesforce Developers
 
Maximizing Salesforce Lightning Experience and Lightning Component Performance
Maximizing Salesforce Lightning Experience and Lightning Component PerformanceMaximizing Salesforce Lightning Experience and Lightning Component Performance
Maximizing Salesforce Lightning Experience and Lightning Component Performance
 
Local development with Open Source Base Components
Local development with Open Source Base ComponentsLocal development with Open Source Base Components
Local development with Open Source Base Components
 
TrailheaDX India : Developer Highlights
TrailheaDX India : Developer HighlightsTrailheaDX India : Developer Highlights
TrailheaDX India : Developer Highlights
 
Why developers shouldn’t miss TrailheaDX India
Why developers shouldn’t miss TrailheaDX IndiaWhy developers shouldn’t miss TrailheaDX India
Why developers shouldn’t miss TrailheaDX India
 
CodeLive: Build Lightning Web Components faster with Local Development
CodeLive: Build Lightning Web Components faster with Local DevelopmentCodeLive: Build Lightning Web Components faster with Local Development
CodeLive: Build Lightning Web Components faster with Local Development
 
CodeLive: Converting Aura Components to Lightning Web Components
CodeLive: Converting Aura Components to Lightning Web ComponentsCodeLive: Converting Aura Components to Lightning Web Components
CodeLive: Converting Aura Components to Lightning Web Components
 
Enterprise-grade UI with open source Lightning Web Components
Enterprise-grade UI with open source Lightning Web ComponentsEnterprise-grade UI with open source Lightning Web Components
Enterprise-grade UI with open source Lightning Web Components
 
TrailheaDX and Summer '19: Developer Highlights
TrailheaDX and Summer '19: Developer HighlightsTrailheaDX and Summer '19: Developer Highlights
TrailheaDX and Summer '19: Developer Highlights
 
Live coding with LWC
Live coding with LWCLive coding with LWC
Live coding with LWC
 
Lightning web components - Episode 4 : Security and Testing
Lightning web components  - Episode 4 : Security and TestingLightning web components  - Episode 4 : Security and Testing
Lightning web components - Episode 4 : Security and Testing
 
LWC Episode 3- Component Communication and Aura Interoperability
LWC Episode 3- Component Communication and Aura InteroperabilityLWC Episode 3- Component Communication and Aura Interoperability
LWC Episode 3- Component Communication and Aura Interoperability
 
Lightning web components episode 2- work with salesforce data
Lightning web components   episode 2- work with salesforce dataLightning web components   episode 2- work with salesforce data
Lightning web components episode 2- work with salesforce data
 
Lightning web components - Episode 1 - An Introduction
Lightning web components - Episode 1 - An IntroductionLightning web components - Episode 1 - An Introduction
Lightning web components - Episode 1 - An Introduction
 
Migrating CPQ to Advanced Calculator and JSQCP
Migrating CPQ to Advanced Calculator and JSQCPMigrating CPQ to Advanced Calculator and JSQCP
Migrating CPQ to Advanced Calculator and JSQCP
 
Scale with Large Data Volumes and Big Objects in Salesforce
Scale with Large Data Volumes and Big Objects in SalesforceScale with Large Data Volumes and Big Objects in Salesforce
Scale with Large Data Volumes and Big Objects in Salesforce
 
Replicate Salesforce Data in Real Time with Change Data Capture
Replicate Salesforce Data in Real Time with Change Data CaptureReplicate Salesforce Data in Real Time with Change Data Capture
Replicate Salesforce Data in Real Time with Change Data Capture
 
Get Into Lightning Flow Development
Get Into Lightning Flow DevelopmentGet Into Lightning Flow Development
Get Into Lightning Flow Development
 
Integrate CMS Content Into Lightning Communities with CMS Connect
Integrate CMS Content Into Lightning Communities with CMS ConnectIntegrate CMS Content Into Lightning Communities with CMS Connect
Integrate CMS Content Into Lightning Communities with CMS Connect
 
Introduction to MuleSoft
Introduction to MuleSoftIntroduction to MuleSoft
Introduction to MuleSoft
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 

Developing Offline Mobile Apps With Salesforce Mobile SDK SmartStore

  • 1. Developing Offline Mobile Apps Salesforce Mobile SDK SmartStore Tom Gersic, Salesforce.com Director, Mobile Services Delivery @tomgersic
  • 2. Safe harbor Safe harbor 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.
  • 3. Tom Gersic Director, Mobile Services Delivery @tomgersic
  • 4. Agenda What we are going to build today Salesforce Mobile SDK Overview SmartStore Terminology SmartSync Walking through some code
  • 7. Data based decisions, in the field, and by the field
  • 8. What we’ll build today https://github.com/tomgersic/Opportune
  • 10. Three Options: Which One Is Right For You? Advanced UI interactions Fastest performance App store distribution Web developer skills Access to native platform App store distribution Web developer skills Instant updates Unrestricted distribution
  • 11. I swear this makes sense!
  • 13. Soups • Hold Indexed JSON Documents • JSON Responses can encompass data from multiple tables Id Soup Created lastModified Index 1 Index 2 Index N… 1 {JSON} 1371069899796 1371070436125 a00E0000009Xj2mIAC Salesforce. com … 2 {JSON} 1371069899802 1371070436126 a00E0000009Xj36IAC Facebook … 3 {JSON} 1371069899803 1371129103154 a00E0000004h2MnIAI Google …
  • 14. REST API Returns a JSON Response /services/data/v28.0/query/?q=SELECT Id, Name FROM Opportunity
  • 16. Some things you can do with your soup… • Register a Soup with an IndexSpec • Query a Soup using a QuerySpec • Upsert Data to a Soup • Delete Data from a Soup • Remove a Soup
  • 17. IndexSpec • JSON Object • Fields to index • “string” or “integer” [ {"path":"Id","type":"string"}, {"path":"Name","type":"string"} ]
  • 18. QuerySpec buildAllQuerySpec(path,order,pageSize) Query all records from the object in the given sort order (or null order) buildExactQuerySpec(path,matchKey,pageSize) Search for records with index path values matching the key. buildRangeQuerySpec(path,beginKey,endKey,pageSize) Return all records with an index path value between the two range values buildLikeQuerySpec(path,likeKey,order,pageSize) Basically “select * from [table] LIKE ‘%[likeKey]%’” buildSmartQuerySpec(smartSql,pageSize) Basically “select * from [table] LIKE ‘%[likeKey]%’”
  • 19. SmartSQL SELECT {departments:name}, {employees:lastName} FROM {employees}, {departments} WHERE {departments:deptCode} = {employees:deptCode} ORDER by {departments:name}, {employees:lastName}
  • 21. SmartSync • Extends Backbone.js • Can be used with or without a SmartStore Cache • Queries returned as Backbone Model Collections
  • 22. Backbone • MV* Framework • Models: Individual records • Collections: Collections of Model records • View: Javascript backing for the stuff that you see • Router: routes everything after the # in a URL to application functions • http://myapp.com/#/user/list
  • 23. Force.SObject • sobjectType: Account, Opportunity, etc. • fieldlist: ["Id", "Name", "Amount", "StageName"] • cacheMode: client, server write order • mergeMode: how to handle conflicts • cache: if using SmartStore • cacheForOriginals: for conflict detection
  • 24. Force.StoreCache new Force.StoreCache(soupName [, additionalIndexSpecs, keyField]) ▪ __locally_created__ ▪ __locally_updated__ ▪ __locally_deleted__ ▪ __local__ (set to true if any of the previous three are true)
  • 27. Tom Gersic Director, Mobile Services Delivery @tomgersic