There is only so much a developer can do if the objects are independent and not related to each other.

In Salesforce there are two types of relationship fields that we can use.

  • Lookup Relationship
  • Master Detail Relationship

Let's look at the differences.

Lookup Relationship

  • This field is an editable field. After saving the record, we can edit the record and assign a new value to these fields.
  • Not a mandate field. However, we can make this as required and make it a mandate field.
  • Loosely Coupled. When a parent is deleted, children records are not deleted. This field doesn’t have cascading delete feature.

Master Detail Relationship

  • Not an Editable field, however, we can make it editable by checking the allow reparenting checkbox at the time of the creation of the field(we can update the already created field too).
  • This field by default is a mandated field.
  • Tightly Coupled. When a parent is deleted, children records are deleted. This variant has cascading delete feature.

When you do data modelling, the option based on which you need to pick one of these two is, if you need cascading delete then go ahead with Master-Detail Relationship else stick to Lookup relationship.

Hope this helps!