Understanding Hierarchical Entity Relationships

Hierarchical entity relationships require that one of the records have a field to store a unique identifier that references another record. The record that stores the reference to another record is called the child record. The record referenced by the unique identifier in the child record is called the parent record.

A hierarchical relationship allows each child record to store a reference to one parent record. A parent record can be referenced by an unlimited number of child records. The parent record can display all the child records in an associated view.

Issues related to Hierarchical relationships include:

Defining Relationships

Relationships are defined between entities. The entity that will represent the child records is called the related entity. A relationship attribute, also known as a lookup attribute, is created on the related entity to allow records to store a reference to a parent record. The entity that will represent the parent records is called the primary entity in the relationship.

When you create or edit a relationship between entities in Microsoft Dynamics CRM Online you must start from one of the entities. Which entity is not important because only one relationship will be created and only one relationship needs to be edited. The terminology used depends on whether you start from the primary entity or the related entity.

Note: It is important to remember that the same relationship can be viewed from either of the two entities that participate in the relationship.

Data Integrity

A hierarchical relationship introduces the opportunity to define rules for data integrity. For example, an opportunity record has no meaning if it isn't associated with a customer record. Microsoft Dynamics CRM Online requires that an opportunity record be related to a customer record. However, a task activity can be meaningful whether it is associated to another record or not. Relating a task activity to another record is optional.

When you create a relationship, you must choose whether to enforce rules for data integrity. If you make the relationship attribute on the related entity a required field by setting a requirement level of Business Required, you can guarantee that each of the related entity records created through the Microsoft Dynamics CRM Online application will be related to a record of the parent entity.

Note: Field level constraints only apply to the Microsoft Dynamics CRM Online application. Records created programmatically through the Microsoft Dynamics CRM Online Web services are not required to respect field level constraints.

Relationship Behavior

Once you create a hierarchical relationship you can control how the relationship behaves to support both data integrity and business rules for your organization. The relationship can control how actions performed on a parent record will cascade down to child records.

You can configure the relationship behavior for the following actions performed on the record of the primary entity:

You can choose from three pre-defined and commonly used types of behavior, or you can choose to configure the appropriate cascading action for each action performed on the record of the primary entity.

The three predefined types of behavior are:

You can also choose to define specific cascading behavior for each of the actions by choosing the Configurable Cascading type of behavior. For most actions, your choices are:

Data integrity must be preserved when data in records changes or when the status of records change. For example, deleting a parent record breaks the data integrity of any child records if the relationship is required. There are three ways to address this:

If the relationship is not required, it is sufficient to remove the data that establishes the link to the deleted parent record.

In addition to data integrity, your business may have rules that should be applied when data in records changes or when the status of records changes. For example, some organizations may want to reassign all child records when the a parent record is reassigned. The Relationship behavior can cascade this action so it does not need to be done manually.

Limitations for Hierarchical Relationships

Mapping

New child records can be created by users in the associated view if they click the New button. When this happens, data from the parent record is copied into the form for the new child record. By default, a reference to the parent record is always copied to the relationship lookup field in the child record. You can choose whether data from other fields should be copied at the same time. More information: Mapping Entity Attributes

Related Topics

Work with N:1 Relationships

Work with N:N Relationships

Work with 1:N Relationships

Entity Relationships

Mapping Entity Attributes

Did you find the information that you need?
Yes      No 
If not, what information do you need? (optional)