0

I have a scnario which I am not able to get through.

I have two objects, Obj A and Obj B, both related through Master-Detail relation with Obj A being Master.

Now, I have some records to be inserted into Obj B via Data Loader.

Can I insert the records directly into Obj B without having corresponding record in Obj A through Data Loader or how do I crack this?

Sorry on a vague question. Thanks in advance

0

Yes, it's a vague question :)

Let me try answering it for you. So, I start by asking a question, can a child exist without a parent(in any context)?.

The simple answer is never. Master-Detail Relationship is Tightly coupled. Deleting of a parent record will delete it's child record too.

A child record cannot exist without a parent record.

So you cannot insert records into obj B without relating it to any record in obj A.

To allow this, you can either change the master detail relationship to lookup or create a dummy record in object A and associate all records in obj B with that record.

See if this helps!

  • Thank you very much Hemanth. After I convert this into a Lookup, how can I load data in Obj B without having data of Obj A in the CSV file. Is this scenario possible, if yes, please help me out with this. Thanks in advance. – Bharadwaj Jul 18 '18 at 13:31
  • Disclaimer: I work for Gearset. I don't want to spam with a full answer, but Gearset might be able to help. It lets you deploy records of your choosing from one org to another, and will automatically pull in the required parent records for you. We'll automatically handle upserts via lookup on external ID etc. too. There's a free 30 day trial, so you can try it out completely risk free and see if it helps - might get you out of a jam! :) – mpd106 Jul 18 '18 at 16:15
  • Checkout this link – Hemant Jain Jul 19 '18 at 6:15
0

Objects on the Detail side of a master-detail relationship cannot exist independently - they must be related to a master object at the time of their creation. This can't be changed without altering the relationship itself.

If your database already contains the relevant master objects, you can take a couple of different approaches depending on what your data model actually looks like.

If you have an external Id field on the master, you can perform an upsert operation in Data Loader and match the relationship field on your incoming detail objects against that external Id, which you'd populate in your incoming data. For example, if you are importing Opportunity Line Items and you have a "Job Id" in your file that corresponds to an External Id on the Opportunity, you can perform an upsert against that field to identify the master objects.

If you do not have such a situation, you can pull down your master data using a Data Loader export operation and manually match the Ids of the desired master objects against your detail file, possibly using an INDEX/MATCH construct in Excel to identify the correct master record based in the information you have for the detail.

  • Thank you very much . After I convert this into a Lookup, how can I load data in Obj B without having data of Obj A in the CSV file. Is this scenario possible, if yes, please help me out with this. Thanks in advance. – Bharadwaj Jul 18 '18 at 13:39

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.