Is there a way to sync records one way from the device to the Journey back end with sync rules?
For example we only create records and never read them for a specific object on the mobile.
Ideally, after the records have been created and synced to the Journey backend, we want them to be desynced from the device.
Hi @alex ,
It is possible to sync records one way from the device to the Journey back end. I will use the location
and product
model below to explain the logic.
schema.xml
<model name="location" label="Location">
<field name="archived" label="Archived" type="boolean" />
<field name="name" label="Name" type="text" />
<display>{name}</display>
</model>
<model name="product" label="Product">
<field name="archived" label="Archived" type="boolean" />
<field name="name" label="Name" type="text" />
<display>{name}</display>
</model>
Data created on a device will automatically sync to our servers. To prevent certain objects from syncing back to devices you can do the following:
1. Do not include the model in any of your sync buckets.
In the code snippet below, only the location
objects will sync to devices. Because product
is not included in the sync rules, it will not sync to devices.
sync_rules.xml
<global-bucket>
<model name="location" />
</global-bucket>
2. Sync data based on a certain condition.
If you have a scenario where you have some archived product
objects and would only like to sync product
objects that have not been archived to users’ devices, you can add a condition as shown below:
sync_rules.xml
<global-bucket>
<model name="location" />
<model name="product" condition="archived != true"/>
</global-bucket>
If you would like to read more about our sync rules please take a look at the additional resources:
Thanks Nidene!