0

I want to create relationship between two Custom Metadatas. When I'm trying to add appropriate field and save, I get message

Cannot Create Master-Detail Relationship You cannot create a new Master-Detail relationship on an existing custom object if records already exist. You must first create a Lookup relationship, populate the lookup field with data in all records, and then change the relationship type to Master-Detail.

I have no records on any Custom Metadata. How can I deal with it?

1
  • I created another bundle of mdt's and successfully created all needed relationship, so I assume the issue could happened because of deleted records left in recycle bin. May 23, 2022 at 17:26

1 Answer 1

1

I faced this same problem. Not only did I not have any records on any Custom Metadata, but I'd never had any, so they weren't in the Recycle Bin.

What was still in the Recycle Bin was a custom field I'd had on the object I was looking up to that looked up the object I was creating a Metadata Relationship field on. Hence it couldn't create the lookup, because the target metadata already had a lookup to the source metadata (in the recycle bin), so I deleted the custom field from the recycle bin (which I had to go to Classic to be able to do, seems like it doesn't work on Lightning.)

Once the custom field I'd deleted was erased permanently, I was able to successfully create the new Metadata Relationship field.

You must log in to answer this question.

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