2

I've been going through this for nearly a week and can't figure it out - any ideas are appreciated.

I'm trying to create a relationship between two custom objects that will eventually be populated with data from CSV files loaded in via dataloader.
The CSV files have the Key and Reference values already set, so all I need to do is import them in and connect them; however, Salesforce isn't letting me link them together.

For example:
Parent.csv has:
- UniqueID (text): 1_1_1

Child.csv has:
- UniqueID (text): 9_a
- MatchingID (text): 1_1_1

What I want is for there to be a master-detail relationship between parent.csv and child.csv where viewing a parent record will display any entries in child.csv (in the example above, viewing parent 1_1_1 would display child 9_a as a related record).

My steps for trying to link the two together so far are:
1) Create the parent Object
2) Create the Unique ID field to match parent to child (which is also the the MatchingID) and set it as as 'unique', 'required', and 'external ID'
3) Create the Child Object
4) Create the Unique ID field for the child and set it as 'unique', 'required', and 'external ID'
5) Create the Matching ID field for the child
6) Create a Master-Detail field on the Child object and select the parent object as the related object
7) Click show filter settings and in the first field box select 'parent > Unique ID'
8) Here's where it breaks Attempt to enter the matching ID in the second field

At step 8, the matching ID is not available to select in the Filter Criteria under Current Record > Child
No field available

tl;dr: Is there a way to import csv files from data loader and create master-detail relationships between them? If not, what are the workarounds? And why the heck does it tell me no fields match the filter criteria?

  • Matching id field is not required. You can upload the based on external id – Santanu Boral Oct 2 '17 at 5:24
2

First of all, matching id is not required to be created.

Create 2 csv files for parent and child objects.

Parent csv should have externalid and in child csv file you should have parent externalId and child external id.

First, you upload the parent csv

Second, you upload the child csv, considering parent externalid for relationship, dataloader provides the options during field mapping.

| improve this answer | |
  • 1
    Good answer but I'd put more emphasis on marking the field on parent as External ID (uniqueness is not enough, ext id is the real game changer). And possibly mention the upsert process (if I remember correctly you can still use ext id tricks in inserts data mapping but if you click upsert - Data Loader has this nice wizard approach to it, makes it easier to understand). – eyescream Oct 2 '17 at 6:36
  • That does indeed work! I was too caught up in the filters I guess. I am curious though - in order for this to work, I need two identical columns in the source CSV in order for the mapping to work properly. One to map to the "mathing ID" field and another containing the exact same value to map to the "relation" field. I'd have to write a script or something to duplicate the column - is this necessary? edit: nevermind! I had the matchingID field listed as required, so it was erroring out. Thanks! Now I just need to port this over to an automated dataloader setup somehow – Bob Jordan Oct 2 '17 at 19:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.