Using the sObject Collection Sync Up Target

For the very best performance in large sync up operations, Mobile SDK 10.1 introduced an sObject collection sync up target.
iOS Native Android Native
Swift
CollectionSyncUpTarget
Objective-C
SFCollectionSyncUpTarget
CollectionSyncUpTarget

This target enhances the standard sync up target behavior by using the Salesforce sObject Collections API. This API sends local records to the server in batches of up to 200 records. This target can be up to five times faster than the Batch sync up target, and up to 10 times faster than the standard single record sync up target.

Actual performance can vary depending on specific records, sObjects, and network conditions.

Note

iOS Native

Objective-C

1SFCollectionSyncUpTarget* target = [[SFCollectionSyncUpTarget alloc] init];
2// or
3SFCollectionSyncUpTarget* target = 
4    [[SFCollectionSyncUpTarget alloc] initWithCreateFieldlist:createList 
5                                              updateFieldlist:updateList];
6
7[syncManager syncUpWithTarget:target 
8                      options:options 
9                     soupName:soupName 
10                  updateBlock:updateBlock];

Android Native

1CollectionSyncUpTarget target = new CollectionSyncUpTarget();
2// or
3CollectionSyncUpTarget target = new CollectionSyncUpTarget(createFieldlist, updateFieldlist);
4
5syncManager.syncUp(target, options, soupName, callback);

Hybrid and React Native

Existing sync up targets in hybrid and React Native apps automatically use the sObject collection sync up target.

This behavior replaces the automatic use of the Batch sync up target. The new sObject collection target is backwards compatible, and should result in improved performance without requiring any changes to your code.

Note

To use a different sync up target implementation such as the legacy SyncUpTarget class, specify that class in the “androidImpl” or “iOSImpl” setting.

Usage in Sync Config Files

By default, sync up targets defined in sync config files use sObject Collection APIs. For example, the following sync configuration creates an sObject Collection sync up target.

1{
2  "syncs": [
3    {
4      "syncName": "syncUpContacts",
5      "syncType": "syncUp",
6      "soupName": "contacts",
7      "target": 
8          {"createFieldlist":
9              ["FirstName", 
10               "LastName", 
11               "Title", 
12               "MobilePhone", 
13               "Email", 
14               "Department", 
15               "HomePhone"]
16          },
17      "options": 
18          {"fieldlist":
19              ["Id", 
20               "FirstName", 
21               "LastName", 
22               "Title", 
23               "MobilePhone", 
24               "Email", 
25               "Department", 
26               "HomePhone"], 
27           "mergeMode":"LEAVE_IF_CHANGED"
28          }
29      }
30   ]
31}