I am new to Salesforce and hope to begin developing ASAP. I am currently testing a theory...I want to use either Contacts or a Custom Object which will have another Custom Object (Special Activities) related list. I want to populate the records in Special Activities from a CSV file, this is exported from an external system and will be uploaded via the DataLoader.

The Special Activities is related to Contacts (or the other objects) via a Lookup Relationship obviously on ID. I can display the email from the Contacts etc on Special Relationship via a formula field however my external export file only contains an email as a reference and a formula field does not allow me to map via the Data Loader (obviously)...Can anyone suggest how I get around this using Salesforce?

Thanks - unfortunately my current thinking means I have to export the Contact ID/Email to a file from Salesforce and then merge with the other csv file before reimporting into Salesforce using the ID - this is long winded and I would struggle to automate nicely.

EDIT : I found exactly the functionality I need via the dataloader.io site, see the link: https://dataloader.io/using-import-lookups. I would like to replicate this in dataloader to automate imports

  • The cusom object to which I would like to upload records (Special Activities) actually has 2 related objects and ideally I would like to use something other than ID to map on data load (in one case the "email" and the other "campaign name (unrelated to the campaign tab). If a solution is offered I would assume the same principle applies for both.......
    – n34_panda
    Commented Jul 15, 2015 at 12:37
  • Are you still an active user?
    – Adrian Larson
    Commented Jul 13, 2016 at 13:16

3 Answers 3


I found Salesforce's own documentation pretty useful on Data Loader and relationships. Good enough to just copy verbatim (aside from minor formatting).

Description of Steps

  1. Add a Text field to your parent object. Make sure you set the length to 18 and mark it as an External Id.
  2. Export your parent records with the Id field included.
  3. When inserting parent records, make sure you map the Id to your newly created External Id field from Step 1.
  4. Upsert the child records based on Id. You can then set what External Id field to use as a lookup for each parent object. Select the field you created in Step 1.
  5. Optionally delete the field you created in Step 1.


  • Can be implemented via Data Loader (free)


  • Requires creation of a new Custom Field

Documentation referenced above:

  1. In the destination Organization, on the Parent Object (in this case, Account), create a new field of type Text and mark it as an ‘External Id’ field. Be sure to make the length of the field at least 18 characters (the size of the Salesforce ID field). Let’s call this new field on Account – ‘Source Acct ID’.
  2. Export the Parent Object (in this case, Account) data from the source Organization into a csv file using Data Loader. Be sure to include the ‘Id’ field when exporting this data.
  3. Insert the data from Step 2 into the destination Organization using Data Loader. In the mapping screen of Data Loader, map the ‘ID’ field from the csv file to the new field created in Step 1 (in this case, ‘Source Acct ID’).
  4. Export the Child Object (in this case, Opportunity) data from the source Organization into a csv file using Data Loader. Be sure to include the relationship field (in this case ‘AccountID’) when exporting this data.
  5. Upsert the data from Step 4 into the destination Organization using Data Loader. In Step 2a of the Data Loader, select ‘ID’ as the field to use for matching Opportunities. In Step 2b of the Data Loader, select the field created in Step 1 (in this case, ‘Source Acct ID’) as the field to match the parent object. In the next mapping step of the Data Loader, map the ‘AccountId’ column of the csv file to the ‘Account:Source Acct ID’ field. This will allow the Data Loader to associate each Opportunity record with its respective parent Account record. Note that the ‘AccountId’ column of the CSV file should NOT be mapped to the standard ‘AccountId’ field (which is what the Data Loader does by default with the ‘Auto-Match Fields to Columns’ option). Instead, it has to be mapped to the ‘Account:Source Acct ID’ field.
  6. After finishing the data import, the new field created in Step 1 (‘Source Acct ID’) may be deleted as it was only necessary for the data import process.

I highly recommend you view the Data Import How To's video series on YouTube which explains how to prepare your data for import, the sequence needed for successful import, use of external Ids and which tools to use for different scenarios. I believe you'll find it will answer pretty much all of your questions.

Email address is one of the included fields that can be used as an external Id. If I'm not mistaken, you can have up to 3 external Id fields.

  1. As Contact is master object, you will first import the Contact records. Then, you can import Activities records.
  2. You will have to relate Activities records against related Contact records. This you can do it by two ways. a. Export(Id,Name,Email) the already imported Contact records. Use the excel VLOOKUp function to relate Activities records with related Contact records. b. If you can create External Id field on Contact record (Text, Number, Email can be external fields). Then you can directly import Activity records. Salesforce system will relate Contact records using External Id field. In this case, you will use UPSERT operation. How do I use an External ID to import related records?
  3. You dont have to map/import Formula fields as they are ReadOnly fields in the system.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .