dreamforce 13 optimizing data sync for mobile apps

20
Optimizing Offline Data Synchronization for Mobile Apps Teodoro Alonso (Ted), salesforce.com, Technical Solutions Architect @tgalonso

Upload: teodoro-alonso

Post on 21-May-2015

190 views

Category:

Technology


1 download

DESCRIPTION

Design Patterns and Techniquea to Optimize Mobile Data Synchronization.

TRANSCRIPT

Page 1: Dreamforce 13 Optimizing Data Sync for Mobile Apps

Optimizing Offline Data Synchronization for Mobile AppsOptimizing Offline Data Synchronization for Mobile Apps

Teodoro Alonso (Ted), salesforce.com, Technical Solutions Architect

@tgalonso

Page 2: Dreamforce 13 Optimizing Data Sync for Mobile Apps

Safe harborSafe 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.

Page 3: Dreamforce 13 Optimizing Data Sync for Mobile Apps

Teodoro Alonso (Ted)Teodoro Alonso (Ted)

Technical Solutions Architect

@tgalonso

Technical Solutions Architect

@tgalonso

Page 4: Dreamforce 13 Optimizing Data Sync for Mobile Apps

Introduction

•By a show of hands, for those of you have implemented a mobile

application that uses Salesforce data offline?

•How many of you think that you accomplished your initial goals for

the mobile app?

•What prevented you from achieving the goals that you set for your

mobile application?

Page 5: Dreamforce 13 Optimizing Data Sync for Mobile Apps

Goal

• Present a set of Good Practices and Design Patterns that

help Optimize Mobile Data Synchronization.

• Describe common pitfalls to avoid when dealing with sync

Page 6: Dreamforce 13 Optimizing Data Sync for Mobile Apps

Why is Mobile Data Synchronization so difficult to implement?

• Too much Data to synchronize in a reasonable amount of time.• Users dread using the App

• Unreliable or slow connectivity can cause:• Unreliable synchronizations

• Synchronization that “never ends”

• Complex Salesforce Data Model results in:• Slow or impossible queries.

• Failed queries due to governor limits

Page 7: Dreamforce 13 Optimizing Data Sync for Mobile Apps

McGraw-Hill Education Artemis Video

Artemis Movie

Page 8: Dreamforce 13 Optimizing Data Sync for Mobile Apps

McGraw-Hill Education Artemis Application Goals

• Eliminate the need to carry around a laptop on campus to access multiple

apps via browser

• Make the sales rep more efficient while on campus and also reduce post-

campus work

• Improve data quality and completeness in Salesforce, resulting in

improved analytics

• Implement common processes to bring new reps up to speed faster

Page 9: Dreamforce 13 Optimizing Data Sync for Mobile Apps

McGraw-Hill Education Artemis Application

• Business Use Case 1: Provide Sales Reps with a Mobile Application to

help them sell products to Campus Professors by enabling them to identify

the most important opportunities tied to different professors and allow them

to plan these meetings using a daily plan while online or offline

• Business Use Case 2: Provide Sales Reps with a way to update the

opportunities, keep notes, create sample orders and update contact data

online and offline.

• Business Use Case 3: Provide Sales Reps with a way to update to show

the targeted product based on the courses that the Professor teaches

opportunities online and offline.

Page 10: Dreamforce 13 Optimizing Data Sync for Mobile Apps

Architecture of the ArtemisMcGraw-Hill Education App

Page 11: Dreamforce 13 Optimizing Data Sync for Mobile Apps

Design Pattern 1: “They don’t need all the data”

The users don’t need “all the data” and you should identify the precious little

data items that are truly required. 

Characterize the user’s need for Salesforce data• Do ride alongs to identify the data that the user’s need in a sales call

• Identify the tasks that the users do and define what tasks have the need for offline data.

• Talk to their managers about what are the goals of the users and what data needs to be collected offline.• Orders, Proposals, Contact, Account, Opportunities account creation/update

• For the updated records, do you need more than the owned records?

Page 12: Dreamforce 13 Optimizing Data Sync for Mobile Apps

Design Pattern 1: Persona Example

Page 13: Dreamforce 13 Optimizing Data Sync for Mobile Apps

Design Pattern 1: “They don’t need all the data” -contSynchronization Worksheet

Object Account Dependency

Synchronization To App

Data Filter MHHE Mobile Sync Flag = True

Address, Contact, Case

Fields Id

Name

Phone

Shipping Address

Do a test “Data Pull” using the Data Loader to estimate the data payload size..

Page 14: Dreamforce 13 Optimizing Data Sync for Mobile Apps

Design Pattern 2: Reduce the number of objects by flattening the data model

Move one or two fields from a parent to a child in a lookup relationship using

formula fields to avoid having to synchronize the parent object.

Reduces the number of different objects and fields to transfer.

Reduces reference resolution post sync

Page 15: Dreamforce 13 Optimizing Data Sync for Mobile Apps

Design Pattern 3: Let Salesforce help Sync Objects

• Add the Mobile_Sync_Flag to the objects to be synchronized. Can be a

Formula field or Set by batch Apex processes (Preferred).• Sync those records WHERE Mobile_Sync_Flag = true

• Much more simple query

• This technique can also be used to do Pseudo-OR id queries: • For example, if we can to pull all the Addresses for all the Contacts OR Accounts already

downloaded to the Mobile App. We can specify the following WHERE clause: ((MHHE_Contact_Flag__c = true AND Contact__r.MHHE_Mobile_Sync_Flag__c = true) OR

(MHHE_Account_Flag__c = true AND Account__r.MHHE_Mobile_Sync_Flag__c = true))

Page 16: Dreamforce 13 Optimizing Data Sync for Mobile Apps

Design Anti-Pattern 1: The User Knows How to Resolve Conflicts

• Pop a modal dialog and ask the user to resolve Synchronization Conflicts.

• Stops the sync completion

• Potentially error prone user interface.

• Does the user have the knowledge to make the correct choices?

• This Anti-Pattern results in a complex user interface with the potential for

corrupt data.

Page 17: Dreamforce 13 Optimizing Data Sync for Mobile Apps

Design Pattern 4: Take the Last Version Unless Salesforce Says Otherwise

• Identify all the objects that will have bidirectional synchronization

• Determines the potential conflict objects

• Will a Last Modified Record Strategy work for all cases?• If so, implement this strategy.

• Assumes that the field value verification can be done locally (Mobile or Salesforce)

• Do you need Salesforce to verify the fields in the mobile originated record?• Implement a “Before Insert” “Before Update” trigger in Salesforce that identifies the

incoming Mobile records and verifies and cleanses the fields as necessary

• Have the Mobile re-Read the Upserted records to insure that it has the cleansed fields

Page 18: Dreamforce 13 Optimizing Data Sync for Mobile Apps

Conclusion

Don’t just push data to a mobile just because they might need it someday.

Carefully select the objects and records that the user absolutely requires

Determine the sync direction for the objects and decide on what to do

for bidirectional sync conflicts.

Simplify the data you send to a mobile to speed up processing post download

Only pull the fields that you need from an object or their parent object

Don’t allocate all the synchronization work on the client

Leverage Salesforce formula fields and batch processes to preselect the

data to be synchronized.

Page 19: Dreamforce 13 Optimizing Data Sync for Mobile Apps

Ted AlonsoTed Alonso

Technical Solutions Architect,@tgalonso

Steve DerenSteve Deren

Senior Technical Consultant

Page 20: Dreamforce 13 Optimizing Data Sync for Mobile Apps