• #40828

    Create field in custom object containing some records with the master-detail relationship

    A 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?

    Salesforce | shariq shariq #1

    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.

    Salesforce | Aman Aman #4


    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.




    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: 25


    Salesforce | Parul Parul #2

    Not possible to create the MD relationship, First create as a lookup then populate each record as a parent then convert into master detail.

Viewing 5 posts - 1 through 5 (of 5 total)

Please to reply to this topic.


We're not around right now. But you can send us an email and we'll get back to you, asap.


About Us

Forcetalks is a Salesforce collaboration platform for coders & developers, geeks & nerds, consultants & business heads, admins & architects, managers & marketers and of course the business owners. A community where you can learn from, where you can contribute to. For you. For Salesforce. Read More...

Copyright 2019 Forcetalks. All Right Reserved.

Log in with your credentials


Forgot your details?