Lookups with Salesforce
You can use Data Sync to lookup values from various sources, for example a CSV file, and use the data within your integration project.
When importing data that is related you need to consider the order you are adding the data in. For example when working with account and contact records, the account should be added first and then contacts with a lookup into the account object to return the AccountID for the Contact record.
If you do not add the account data before the contact records then you will not be able to link the objects for those records in that run and will need to run the project again when the account data has been created.
You can also use lookups to include additional data within your schema mapping that otherwise wouldn't be available in your source data. You may also want to lookup and return values within Salesforce to ensure that the data is presented correctly.
Below we will cover the three ways in Data Sync you can create a Lookup.
Creating Lookups
To create a lookup column you should have already saved your connection to Salesforce in the Connection Library, if you have not yet done this please connect to Salesforce and click Connect & Create Library Connection to save it. This will make configuring your lookups much easier.
Drag and Drop
The easiest way to create a lookup is to drag the Salesforce object you want to look the values up in, onto the source column that contains the values to lookup.
This will then open the lookup configuration window, where you need to select the column that links the two objects. In this example it is the Id column from the Accounts Object linked to the AccountId column in the Contact Object. Make sure to select the correct data type for that column.
Once you are done click OK and the columns will be available in the source window. You can then add the column/s you need into the schema map and link them to their corresponding target column.
Lookup Buttons
Another option is to create the lookup using the lookup button in the datasource toolbar. To use this select the column you want to apply the lookup to and select the create lookup button.
Then either create the connection or click onto the Connection Library tab and select your Salesforce connection. Make sure to select the Salesforce object you want to lookup in and click Connect & Update Library Connection. This will then open the lookup configuration window.
Here you need to select the column that links the two objects. In this example it is the Id column from the Accounts Object linked to the AccountId column in the Contact Object. Make sure to select the correct data type for that column.
Once you are done click OK and the columns will be available in the source window. You can then add the column/s you need into the schema map and link them to their corresponding target column.
Calculated Columns
Alternatively you can create lookups via in-line LOOKUPA/B functions using calculated columns:
The below example shows the expression used to get the Name of the account from the account object when the Id of the account is equal to the AccountId column found in the source data.
LOOKUPB("name", "account", WHEN("Id", AccountId))
You would then add this column to the schema map and link it to the corresponding column in the target.