Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
Using the Batch Sync Up Target
| iOS Native | Android Native |
|---|---|
|
BatchSyncUpTarget |
This target enhances the standard sync up target behavior by calling the Salesforce composite API. The composite API sends local records to the server in batches of up to 25 records.
iOS Native
Swift
1var target = BatchSyncUpTarget.init(createFieldList, updateFieldList)
2let syncMgr = SyncManager.sharedInstance(store: self.store!)
3syncMgr!.syncUp(target: target, options: options, soupName: soupName) {...}Objective-C
1SFBatchSyncUpTarget* target = [[SFBatchSyncUpTarget alloc] init];
2// or
3SFBatchSyncUpTarget* target =
4 [[SFBatchSyncUpTarget alloc] initWithCreateFieldlist:createList
5 updateFieldlist:updateList];
6[syncManager syncUpWithTarget:target
7 options:options
8 soupName:soupName
9 updateBlock:updateBlock];Android Native
1BatchSyncUpTarget target = new BatchSyncUpTarget();
2// or
3BatchSyncUpTarget target = new BatchSyncUpTarget(createFieldlist, updateFieldlist);
4syncManager.syncUp(target, options, soupName, callback);Hybrid and React Native
Existing sync up targets in hybrid and React Native apps automatically use the batch sync up target. To use a different sync up target implementation such as the legacy SyncUpTarget class, specify “androidImpl” or “iOSImpl”.
Usage in Sync Config Files
By default, sync up targets defined in sync config files use batch APIs. For example, the following sync configuration creates a batch sync up target.
1{ "syncs": [
2 {
3 "syncName": "syncUpContacts",
4 "syncType": "syncUp",
5 "soupName": "contacts",
6 "target":
7 {"createFieldlist":
8 ["FirstName",
9 "LastName",
10 "Title",
11 "MobilePhone",
12 "Email",
13 "Department",
14 "HomePhone"]
15 },
16 "options":
17 {"fieldlist":
18 ["Id",
19 "FirstName",
20 "LastName",
21 "Title",
22 "MobilePhone",
23 "Email",
24 "Department",
25 "HomePhone"],
26 "mergeMode":"LEAVE_IF_CHANGED"}
27 }
28]}