Hello FSM Experts,
When we have a custom table as a child table of Task, what is the best way to configure its sync rule?
Is it adding a separate custom sync rule OR including the custom table in the existing sync rule of the Task table?
Regards,
Dulshan.
Hi Dulshan,
Although it is technically possible to either create a separate Sync Rule for the new custom entity or to add it to the existing task Sync rule, the 2 approaches will result in different behavior.
First, lets see what happens if this is added as a separate new Sync Rule. The Sync Rule can be added as either a real-time or batch (batch-All, batch-delta) depending on the required sync behavior. Since this entity is related to the task I assume changes to this table need to be synced real time, thus a real time Sync Rule is needed. If a new sync rule is created, every time a record in this new table gets added/ updated/deleted, the changes would sync to the mobile. However, since its added as an individual Sync Rule, when an existing task gets assigned to the mobile user, it won’t sync the related records of the new custom table. Means that, it will only sync the records from new custom table, only if a change occurs in that record.
Secondly, if the new table is added to the existing task sync rule (assuming added to both Initial Query and Related Query) then, every time a task gets assigned, the related records will be synced to the mobile (Also records will be cleared out when a task gets cancelled…etc). However, this sync rule alone will not sync the changes that occurs to the actual record in the new table.
So, as a summary, if you want the records in the new table to be synced whenever particular record gets added/changed you need to create a separate sync rule. If you need the related records to be synced along when the task gets assigned, then you need to add it to the task sync rule.
Also make sure to use the correct filtering by defining data constraints in the sync rule.
A good example is to look at an existing baseline sync rule that is of an entity that is related to task table. Ex: TASK_TEXT table is connected to task and shows the task notes. This has a separate sync rule named TASK_TEXT that has an initial query as well as an ownership query. The ownership query is filtered by the task_ids owned by the current person.
The TASK Sync Rule has the TASK_TEXT table added as a related table in Initial and Related queries. Further, a data constraint to filter the task_text records related to the current task using task_id.
Best regards,
_ Thilina W
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.