What is a Lookup?
A lookup is a relationship between two objects. Salesforce objects often include lookup fields that allow you to associate two records together in a relationship. For example, a Contact record includes an Account lookup field (AccountId) that represents the relationship between the contact and its associated account. The object that contains the lookup field is the source object, while the object the lookup points to is the target object.
When should I use Lookups in Dataloader.io?
Lookups can be very useful when you need to import information from an object and its relationships with other objects on a single operation, for example: uploading Contacts associated with their parent Account.
Let’s see an example:
On this example we'll Import Contact information. Suppose you have a source file with Contact's first and last names and that you know the Account names to which you want to associate each of those contacts... the problem is that you're missing the Ids from those Accounts (which you need to link them with your contacts).
Here is what the source file looks like:
You can create a new Import Task and, when you reach the Mapping step, map the Account Name to the AccountID in Salesforce and click the "Lookup via" checkbox.
This will open up a couple of options that will let you specify what field from "Account" you are providing to use for the lookup.
In this example 'Account Name' needs to be selected, which is the field you want to use to search the ID. So, when you run the task, Dataloader.io will go and search for the Account ID using the Account Name on each case, and send the IDs that Salesforce is expecting.
When using lookups you are inferring a unique value (ID) based on what might be on a non-unique field (ex.: First Name, Last Name, etc...). This could result in having a query that returns multiple values for your refference values; for instance, we could end up having more than one contact with the same first and last names.
In those cases you have two options:
Use first Match in multiple results
Dataloader.io will pick the first value if more than one match is found for the selected non-unique field. Following the example above, there might be more than one Account under the name 'Great Consulting', in this case Dataloader.io will just use the ID of the first occurrence of those Accounts.
Mark Record with an error if more than one match is found
Dataloader.io will mark the row with an error message saying more than one match is found for your non-unique field. You can later pick the errors file and fix this problem either in Salesforce or by passing the ID directly and re-uploading the file.
Insert null value(s) if no match is found
This option enables to insert null values or create no lookup relationship between the objects if no matches are found.
Other uses for lookups
Besides inserting, you can also use Lookups to do Update, Upsert or Delete data when you don't have the Id fields.