Study for the Salesforce Platform Developer Exam. Study with flashcards and multiple choice questions, each question has hints and explanations. Get ready for your exam!

Practice this question and more.


What is the maximum number of master-detail relationships an object can have?

  1. 1

  2. 2

  3. 25

  4. 300

The correct answer is: 2

The correct answer is that an object can have a maximum of 2 master-detail relationships. This limitation is in place because master-detail relationships define a strong relationship where the detail (child) record’s lifecycle is dependent on the master (parent) record. When a master record is deleted, the associated detail records are also deleted automatically. Having a limit on the number of master-detail relationships helps maintain data integrity and manage complexity. By restricting it to two, Salesforce ensures that the relationships remain manageable, allowing developers to build applications that are easier to maintain and understand. It also keeps the system performance optimal by limiting the depth of relationships, as more complex hierarchies could lead to difficulties in data management and querying. While there are other types of relationships in Salesforce, such as lookup relationships, these do not have the same limitations and can provide flexibility when designing data models. However, the constraints on master-detail relationships are specifically designed to ensure that the powerful cascading delete functionality and access control they provide are well-governed.