Activity › Forums › Salesforce® Discussions › Can we create field in custom object containing some records with master detail relationship in Salesforce?
Tagged: Child Record, Custom Fields & Relationships, Lookup Fields, Master Detail Relationship, Parent Record, Salesforce Custom Object, Salesforce Records
-
Can we create field in custom object containing some records with master detail relationship in Salesforce?
Posted by Parv Shekhar Singh on September 29, 2018 at 9:26 AMA custom object contains some records, now my requirement is to create the field in this object with the master-detail relationship. Can we create master-detail relationship in this case?
Aditya replied 6 years, 2 months ago 7 Members · 7 Replies -
7 Replies
-
No, directly we cannot create master-detail relationship if custom object contains existing records.
Following are the steps to create master-detail relationship when records are available in custom object.First create field with lookup relationship.
And then associate look field with parent record for every record.
Next change the data type of the field from look up to Master detail.
- [adinserter block='9']
-
Hi
Read these steps:
To create the master-detail relationship field to relate custom object with the account objectFrom Setup, enter Objects in the Quick Find box, then select custom object
Click Review.
In the Custom Fields & Relationships related list, click New.
Select Master-Detail Relationship, and click Next.
In the Related To drop-down list, choose account, and click Next.
Click in the Field Name text box and enter the field name —-.
Select the Read/Write radio button.
Check Child records can be reparented to other parent records after they are created if you want to be able to change the relationship field’s value. If you leave this box unchecked, you can’t change the value in the future.
Click Next.
Accept the defaults in the remaining three steps of the wizard.
Click Save.Thanks
-
Hello,
You need to create the lookup, then populate each one so that each child record has a parent record. This is because a master-detail relationship does not allow for ‘orphaned’ child records. Once you have a lookup with each child having a parent, then you can go back and convert the lookup field to a master-detail.
But Remember,
Maximum number of Master-Detail relationships on a Custom Object is: 2
Maximum number of Lookup relationships on a Custom Object is: 25
Maximum number of Lookup relationships on a Standard Object is: 25Thanks.
-
Not possible to create the MD relationship, First create as a lookup then populate each record as a parent then convert into master detail.
-
No, We can not create a field in custom object containing some records with master detail relationship in Salesforce.
-
Yes,We Can create field in custom object containing some records with master detail relationship in Salesforce
-
Hi,
Salesforce will not accommodate a master detail relationship to a custom object that already contains data. This is because creating a master detail relationship adds a new required field to the custom object (known as a “foreign key” to database administrators).
Log In to reply.