In the HubEngine you have the possibility to create a relation lookup within a plan for the synchronization in the field mapping. This maps the value of a field based on a lookup. The following example illustrates how it works. We are synchronizing unidirectional (whether unidirectional or bidirectional makes no difference in this case, for simplicity we will take unidirectional) contacts and accounts each.
We have four modules:
- System A – Contacts
- System B – Contacts
- System A – Accounts
- System B – Accounts
In addition, there are the relations for the Relation Store between the contacts and accounts each. Contacts in system B do not exist yet and are to be synchronized now. The other modules contain the following records:
System A - Contacts
ID | Name | Account_ID |
---|---|---|
1 | John | A1 |
2 | Jane | A2 |
3 | Mary | A1 |
System A - Accounts
ID | Name |
---|---|
A1 | Company_1 |
A2 | Company_2 |
System B - Accounts
ID | Name |
---|---|
B1 | Company_1 |
B2 | Company_2 |
Account Relations
ID System A | ID System B |
---|---|
A1 | B1 |
A2 | B2 |
If we now synchronize the Contacts by mapping the fields without any additional action, we would get the following data:
System B - Contacts
ID | Name | Account_ID |
---|---|---|
A | John | A1 |
B | Jane | A2 |
C | Mary | A1 |
The Account_ID is transferred. The Account_ID from system A is now in system B. However, we want to store the Account_ID from system B in this field. That is, we want to get the following table, so that in system B relations between Contacts and Accounts can be created:
ID | Name | Account_ID |
---|---|---|
A | John | B1 |
B | Jane | B2 |
C | Mary | B1 |
For this we use the relation lookup in the field mapping of the Contacts synchronization plan. When we map the Account_ID field, we select “relation_lookup” as the type. In doing so, we configure that the Account_ID of the transferred record is used for a lookup in the Relation Store of the plan for synchronizing the accounts. Practically, this is what happens:
- The record with the ID “1” (Contacts) from system A should be transferred. Instead of simply transferring the Account_ID “A1” as a value, this value is used to look up the Account_ID from system B in the plan’s Relation Store for the account synchronization.
- Account_ID “A1” is looked up in the Account Relations table above (representing the plan’s Relation Store). We get back “B1” as the looked up value.
- “B1” is transferred as the value for the Account_ID field.
- We properly get the desired table for Contacts in System B.
Implementation in the HubEngine
In the HubEngine you can set up the relation lookup by navigating to the corresponding “Connection” tab in a plan. There you configure the lookup in the mapping. Here we are synchronizing contacts and accounts from SAP to HubSpot. The screenshot shows the plan for syncing contacts. We want to perform the lookup equivalent to the example above.
- System A = SAP
- System B = HubSpot
Select the Type “relation_lookup” in the mapping. The button “select relation” will appear.
If you click on the button “select relation” you will get to the following selection mask.
As soon as you select the plan (1. Select Plan), the second step on the right appears. Here you select which ID you want to use for the lookup.
Since we are syncing from SAP to HubSpot (SAP -> HubSpot), we select the ID of SAP. This will be used to lookup the value of the ID from HubSpot and transfer it to the field specified in the mapping.
You will then be taken back to the mapping and can continue there.