Relationship betwen Account and Contact in Salesforce.

Relationship betwen Account and Contact in Salesforce.

The relationship between Accounts and Contacts in Salesforce functions as a lookup relationship. Initially, when creating a Contact, it's not obligatory to specify the parent Account, resembling a standard lookup relationship.

However, under certain circumstances, this relationship transitions into a master-detail-like behavior. When an Account (parent) is deleted, the associated Contacts (children) are also removed, akin to the behavior of a master-detail relationship.

Accounts and Contacts are linked together through a lookup relationship, with a feature called "cascade-delete" enabled, meaning that when the parent object (Account) is deleted, the associated child objects (Contacts) are also deleted automatically

Accounts represent the entities or organizations with which we conduct business, while Contacts denote the individuals who are affiliated with those organizations and work for them.

This type of relationship allows for creating Contacts without specifying an associated Account, but it also permits creating Contacts with linked Accounts.

Master-detail relationship:

This relationship can be considered a parent-child relationship, where the record on the Master side acts as the "parent" and the record on the detail side acts as the "child." The detail record inherits ownership, sharing settings, and the record owner from the master records. When the master object is deleted, any associated child objects are also removed.

Lookup relationship:

A lookup relationship is a less tightly bound connection where one object references another. It allows one object (child) to associate with another object (parent) without needing the parent record to exist. A single parent record can be linked to multiple child records, and the child record can stand alone without the parent record.when you delete the master object, the related child objects are not automatically deleted.