Posts

Showing posts with the label Master-Detail

Junction objects in Salesforce

In Salesforce, a junction object is a custom object with two master-detail relationships, typically linking two other objects together in a many-to-many relationship. Junction objects are used to model complex relationships between records in a way that cannot be represented by a direct master-detail or lookup relationship. Here's a common use case for junction objects: Use Case: Student Enrollment in Courses Consider a scenario where you have two objects: Student and Course. Each student can be enrolled in multiple courses, and each course can have multiple students enrolled. However, you also need to track additional information about each student's enrollment in a specific course, such as enrollment date, grade, and attendance. To model this scenario using junction objects, you would create three custom objects: Student : Represents individual students. Course : Represents individual courses. Enrollment (Junction Object) : Represents the many-to-many relationship between st...

Master-Detail and Lookup relationships in Salesforce

Image
In Salesforce, Master-Detail and Lookup relationships establish relationships between objects. Here's an explanation of each: Dependency and Data Integrity: Master-Detail Relationship: Child records are tightly bound to parent records. If a parent record is deleted, all associated child records are deleted. This ensures strong data integrity and dependency between records. Lookup Relationship: Child records can exist independently of parent records. Deleting a parent record does not automatically delete associated child records. This offers more flexibility but results in weaker data integrity than Master-Detail relationships. Ownership and Control: Master-Detail Relationship: The parent object owns the relationship, and the child object is subordinate. The child record inherits security and sharing settings from the parent record. Master-detail relationships are typically used for objects with a clear parent-child relationship where the parent owns the child's records. Lookup ...