1

I am trying to sync data created in a mobile app (currently iOS, but I've had exactly the same problems with smartsync on Android before).

I have a local soup registered that includes a field with path = '__local__' and type = 'string'

The name of the soup is the same as the name of an Object in Salesforce, and all the field names match exactly.

I am calling smartsync.syncUp with exactly the same parameters as in the example. That is:

smartsync.syncUp(false,
                {}, 
                $(OBJECT_NAME), 
                {mergeMode: smartsync.MERGE_MODE.OVERWRITE, 
                 fieldlist: [$(COMMA_SEPARATED_PATHS)]}, 
                (res) => {
                    console.log("Successfully synced to server. Result: ");
                    console.log(res);
                }, (err) => {
                    console.log("syncUp failed with error: " + err); 
                }); 

This results in the 'success' callback being called with an object that seems to reflect the options and fieldlist I provided, but with totalSize = 0. None of the changes are reflected in Salesforce.

Has anyone else ever had this problem?

1

Do you have any rows in your soup?

A row that you would expect to "sync up" to salesforce should look like the following:

{ 
  __local__: true, 
  __locally_created__: true, 
  __locally_updated__: false, 
  __locally_deleted__: false, 
  attributes: { type: 'MySObject__c' } 
}

The important components here are __local__, __locally_created__, and attributes. Local tells smartsync that the object is something that needs to sync, locally created tells smartsync that the type of sync that needs to happen is an insert operation. Attributes/type/mysobject__c tells smartsync that the type of SObject that needs to be created is MySObject__c.

  • Thanks, the issue was that I missed the attributes part in the soup rows. Sorry for the late reply, I also ran into an unrelated issue that slowed me down a bit. – SoZettaSho Apr 5 '17 at 15:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.