function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
mobile1.390759152613193E12mobile1.390759152613193E12 

StoreCache.find() doesn't work if searching on non "standard" Indexed fields

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. 

Dominic Blythe .Dominic Blythe .
What you put here looks ok. Maybe the problem is with something else.
akhilesh_sfdcakhilesh_sfdc
just to check, are you calling app.cacheContact.init() before you use this StoreCache? Checkout the AccountEditor sample app for usage example. Here's the code: https://github.com/forcedotcom/SalesforceMobileSDK-Shared/blob/master/SampleApps/smartsync/AccountEditor.html#L522