Activity Forums Salesforce® Discussions Can we create a field in custom object with the master-detail relationship in Salesforce?

  • Prachi

    Member
    August 14, 2018 at 8:27 am

    Hello Avnish,

    No, directly we cannot create master details relationship if custom object contains existing records.
    Following are the steps to create 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 recordNext change the data type of the field from look up to Master detail.

    THanks

  • Parul

    Member
    September 10, 2018 at 12:50 pm

    Hi

    Master-detail relationship is like parent-child relationship where, master represents a parent and detail represents a child in which master object controls some behaviors of the detail object. Like whenever a Master object record is deleted then the detail object related to it also gets deleted.

    So, we can't create a Master-detail relationship on existing records. To do that, we have to create a lookup relationship for that record and then convert it into master detail.

    To convert a lookup relationship to a master detail the existing record should consist of valid lookup field values.

    Thanks.

  • shariq

    Member
    September 15, 2018 at 11:25 am

    Hi,

    We can't create a Master-detail relationship when the custom object already contains data. Each object is allowed to have one or two masters or up to 8 details. After converting a lookup field into Master-detail relationship, test your customreports, whether they are usable or not.

    Hope this helps.

    • This reply was modified 6 years, 2 months ago by  shariq.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos