Synchronizing Source and Target Records
Checklist
To synchronize source and target records:
Steps | ||
---|---|---|
1 | Ensure that Sync Enabled is selected in the ClickLink Settings custom setting. See Activating and Deactivating Synchronization. | |
2 | Add a lookup field on the target header object that points back to the source header object. | |
3 | Create a mapping in your ClickLink header rule that maps the source header object's ID field to the lookup field in the target object that you created in the previous step. | |
4 | Add a lookup field on the target detail object that points back to the source line object. | |
5 | Create a mapping in your ClickLink detail rule that maps the source detail object's ID field to the lookup field in the target detail object that you created in the previous step. | |
6 | Create a checkbox field on the target header object with the name: IsSyncing__c. | |
7 | Create a formula number field called IsSyncing__c on the on the target detail object that sets its value based on the field you created in the previous step. For instance, IF( c2g__Invoice__r.IsSyncing__c , 1, 0) . |
|
8 | We recommend that you create a literal mapping in the header ClickLink rule that maps the value True to the IsSyncing__c field on the target header object. This will automatically synchronize target records with source record when they are created. | |
9 | In the Synchronization Setup section of the header ClickLink rule: | |
|
||
|
||
|
||
|
||
10 | In the Synchronization Setup section of the detail ClickLink rule: | |
|
||
|
||
|
||
|
||
11 | In the header ClickLink rule, select the Source Sync checkbox in each mapping that is to be synchronized. | |
12 | In the detail ClickLink rule, select the Source Sync checkbox in each mapping that is to be synchronized. | |
13 | Create the following Apex trigger in the source header, source detail, target header and target detail objects:trigger NameofObjectSyncTrigger on APINameofObject (after delete, after insert, after undelete, after update, before delete, before insert, before update)
{
ffirule.IntegrationRuleEngine.triggerHandler();
} |
|
14 | Create a target record from a source record using the ClickLink button. If you did not create a literal mapping as recommended in step 8, on the target record that you created in the previous step, select IsSyncing. |
Testing Synchronization
Once you have synchronized the records in your source and target objects, we recommend that you carry out these tests to ensure that synchronization is working in the way you expect. If synchronization is not working, ensure that you have correctly carried out the steps in the checklist. See Checklist.
To test synchronization between source and target records:
- Create a target record using the button on your source record that runs your ClickLink rule.
- If you did not create a literal mapping as recommended in step 8 in the checklist above, in the target record that you created in the previous step, select IsSyncing.
- In each target line item, check that the value of the Is Syncing field is 1.00.
- Edit the related list of the source object so that you can view the target object records to which it relates.
- Edit a field on the source record that is synchronized with a target record.
- Click Save.
- Check that the value you changed has also changed on the target record.