• Dominic Blythe .
  • NEWBIE
  • 0 Points
  • Member since 2014
  • Alpha Financial Markets Consulting

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    Replies
I am building an app with MobileSDK 2.1, it's based on Account Editor sample app.

I can edit and save my record offline, but then if the app comes online and the collection it is part of is fetched from the server again, the server version overwrites the local changes.

I have been hoping that there's a way to get the Merge Mode taken into account so local changes are preserved but unchanged fields are updated from remote. The code that's processing the fetch in the smartsync library Force.StoreCache.saveAll has some code that looks like it's doing a merge with local records, at the record level, but the result is "all the remote fields".

I think it's pretty important that local edits aren't overwritten with older remote data. The example app seems to achieve this by not refreshing the main collection, but it's also important to keep that up to date, which is why I want the collision-detection to happen.
Hey there,

Kindly let me know if  it Is possible to create a cross device salesforce app that support offline capabilities (working offline)?

I am having issues in makeing StoreCache.find() work on fields that are not the standard indexed (__loclal__, ID).

Here is how I setup the cache:

app.cacheContact = new Force.StoreCache("contacts", [ {path:"Account.Id", type:"string"} , {path:"LastName", type:"string"}]);

I assign it to the contact model:

model: app.models.Contact,
cache: function() { return app.cacheContact },

When I try to use the following query (inside a model):

return {type:"cache", cacheQuery:{queryType:"exact", indexPath:"Account.Id", matchKey:(this.key == null ? "" : this.key), order:"ascending", pageSize:25}}

I get the following error on the console:

DEBUG|SFSmartStore|Unknown index path 'Account.Id' in soup 'contacts'

I tried also to change the name of the field to AccountId. Same error happens If I use the field Email or Phone or any other.
find works only on the fields __local__, ID, and FirstName  (it doesn't work for LastName)... weird...

Thanks a lot for any help you could provide

Maurizio.