Relationships in Salesforce : In this training tutorial we are going to know about relationships in salesforce. In general we know what a relationship is ? Relationship is the way in which two or more people or things connected with each other. The way they connected will be of different types like wise in salesforce there are 4 different types of relationships in salesforce.

Different types of Relationships in salesforce.

  1. Master-Detail relationship.
  2. Lookup Relationship.
  3. May-Many Relationship.
  4. Hierarchy Relationship (we can not use this relationship).

Master-Detail Relationship

  • Child record must have a  associated parent.
  • Cascade record-level security.
  • Cascade record deletion.
  • Roll-up Summary fields can be established.
  • Standard objects can not be a detail object.
  • Standard Objects can be a Master object
  • Maximum 2 Master-Detail Relationships can be created to a Object.
  • Records can be re parented.

Child record must have a  associated parent.

In Master-Detail Relationship the “child object” or “detail object” must have a parent.

Cascade record-level security.

Cascade record level security means the child record inherits cascade level security from the parent.So the user can view a parent record and he will be available to view associated child object to that Parent object.

Cascade record deletion.

Cascade deletion in salesforce means child records will be automatically deleted when parent object is deleted.

Roll-up Summary fields can be established.

In Master-Detail Relationship we can create Roll-up Summary fields.Roll-Up-Summary fields are those which are used to summarize data with any associated child object.

Standard objects can not be a detail object.

In Master-Detail Relationship we can not use Standard objects as child object.

Lookup Relationship.

  • No parent is required.
  • Relationship is optional.
  • No impact on Security.
  • Roll-Up summary fields cannot be available.
  • 25 lookup relationships can be created to one Object.

Many-Many Relationship.

  • Many-Many Relationships between two objects can be created.
  • Junction Object is used to create Many-Many Relationship.
  • Junction object can also be called as Join Object.
  • Junction Object links each objects in Many-Many Relationship.

How to create Master-Detail Relationship in Salesforce