Thursday, August 15, 2013

MSCRM – Entity Relationships Explained

Definition

Entity Relationships is to define the data relationships between two entities in the system metadata.

Dynamics CRM design gives the flexibility to manage the data relationships thru the metadata without touching the underlying SQL database keys.

These settings can be managed within the entity form in the design mode.

Dynamics CRM supports basically supports 2 relationships between any two entities -
1: N and N:N



Entity Relationships

1:N (one-to-many)
A 1:N relationship refers to the relationship between two entities in which a single entity record of one type can associate with multiple related entity records of another type. Example: One Account can have multiple contacts associated.

If the above same example is seen from the standpoint of the contacts, it will be referred as N:1 relationship.Technically, there is no difference between 1:N and N:1 relationships. The terminology differs based on which entity is the focal.

Note: Whichever way the relationship is created, Microsoft Dynamics CRM automatically creates the inverse entry on the associated entity.

N:N (many-to-many)
A N:N relationship refers to the relationship between two entities in which both entities are considered as related entities. Not every system entity can be included in a N:N relationship.In Microsoft Dynamics CRM, there are two ways to create N:N relationships.

Native N:N
An Native N:N relationship is created by the system utilizing an hidden intersect entity. The intersect entity is created by the platform where the users merely provide the names of the related entities.

Since the intersect entity is hidden, it is not available for customization and workflow rules.

Manual N:N
An Manual N:N relationship is created by the implementer utilizing a combination of two N:1 relationships that share a common intersect entity. Here the intersect entity is created by the implementer and not hidden. The intersect entity acts as the related entity in both the N:1 relationships

Creating a series of N:1 relationships in this manner creates a de-facto N:N relationship

Relationship Behavior

Relationship behaviors defines how certain actions taken on a record affects the related records. You must focus on the behavior of the entity relationships before you create entity relationships.

Entity relationships are designed to exhibit either one of two behaviors-

1. Parental
Actions taken against the primary entity also apply to its related entity.

2. Referential
Actions taken against the primary entity apply only to that entity, and not it’s related entities.

A special case of Referential behavior is Referential, Restrict Delete. In this case, Microsoft Dynamics CRM does not allow the user to delete the parent entity if that entity has any related entities.


More information

The different type of behaviors provided are,
Parentalo In a parental relationship between two entities, any action taken on a record of the parent entity is also taken on any child entity records that are related to the parent entity record. if you delete a record in the parent entity, the related child entity records are also deleted; or if you share a parent entity record, the related records from the child entity are also shared. All option are disable for Parental relationship
Referentialo In a referential relationship between two entities, you can navigate to any related records, but actions taken on one will not affect the other
Referential, Restrict Deleteo Actions taken on parent will not affect child record but parent record cannot be deleted till the child record exists. i.e you cannot delete a record when related records exist.
Configurable Cascadingo You need to specify your setting here.

Actions

Only 6 actions are affected by relationship behaviors:
  • Assign
  • Reparent
  • Share
  • Unshare
  • Delete
  • Merge
Consequently, if you take any other action against an entity, that action is not affected by the entity’s relationship behavior.

The relationship behavior can be applied as a group (parental, referential or referential restrict delete) affecting all the actions in a pre-defined manner or separately for each action. The configuration options of the relationship behavior for each action are referred as cascading rules.

Cascade Rules

There exist 4 Cascade rules for each action (except delete and merge)
1. Cascade All
Equivalent to Parental behavior. All actions are propagated down the child entities.
2. Cascade Active
Perform the action on the parent entity and only those child entities whose status is active or open.
3. Cascade User-Owned
Perform the action on the parent entity and only those child entities owned by the same owner as the primary entity.
4. Cascade None
Equivalent to Referential behavior. Perform action only on the parent entity

For Delete
1. Cascade All
2. Remove Link
Equivalent to Referential behavior. Deletes the link between entities but do not delete the child entities
3. Restrict
Equivalent to Referential, Restrict Delete. Prevents the user from deleting an entity that possesses child entities.

For Merge
1. Cascade All

Snippets:

1. Supported 1:N relationships

System – Custom
Here the System entity is the primary entity and a custom entity will be the related entity. The relationship behavior can be parental or referential.

Custom – System
Here the Custom entity is the primary entity and a system entity will be the related entity. The relationship behavior cannot be parental, but can be referential. In Other words, you cannot have a relationship with any action set to Cascade All, Cascade Active or Cascade user-Owned between a primary custom entity and a related system entity.

Custom – Custom
Here both the primary entity and the related entity are custom entities. The limitation on the relationship behavior is that only one relationship can be a parental relationship.

2. Unsupported Relationships
1:N Customer to Custom Entity1:1 Any to Any

3. Self – referential 1:N or N:N relationships are permitted, although it cannot be circular.

4. N:N relationships always exhibit referential behavior

5. When cascading rules applies to actions, user must have privileges to perform the action on both primary & related entities.

6. Each entity can have only one parent:- A new relationship cannot have any action set to Cascade All, Cascade Active or Cascade User-Owned if the related entity in that relationship already exists as a related entity in another relationship that has any action set to Cascade All, Cascade Active, or Cascade User-Owned.

7. Before a relationship can be deleted, all references to attributes from resulting relationship on published forms and views must first be removed.

8. Relationships can be deleted in 2 ways:
  • Delete the relationship
  • Delete the relationship attribute
From : kSk

Limitations for Hierarchical Relationships 

  • Each entity can have only one parental relationship. Most Microsoft Dynamics CRM system entities already have a parental relationship and this relationship cannot be changed. 
  • Entities can have referential relationships with any entity, including business entities. You can create multiple relationships between two entities. Entities can have referential relationships with themselves, allowing linked records of the same type. However, a record cannot be linked to itself. 
  • In Microsoft Dynamics CRM, the customer entities are Accounts or Contacts. These two entities together represent a composite Customer entity. Some Microsoft Dynamics CRM business entities, such as Opportunity and Case must be related to a Customer. However, you cannot create this type of relationship with custom entities. 
From here


Dynamics CRM 3.0 information

http://www.megasolutions.net/MS_Dynamics_CRM_3_0/UnderStanding_Entity_Relation.aspx












2 comments:

  1. Remarkable blog! I have no words to praise, it has really allured me.how to fix marriage on your own

    ReplyDelete
  2. I'M NOW FULFILL FINANCIALLY BECAUSE OF THE LOAN I GOT FROM LFDS .I would like to bring this to the notice of the public about how i came in contact with LFDS after i lost my job and being denied loan by my bank and other financial institution due to my credit score. I could not pay my children's fees. I was behind on bills, about to be thrown out of the house due to my inability to pay my rent, It was during this period my kids were taken from me by foster care. Then i set out to seek for funds online where i lost $3,670 that i borrowed from friends which i was rip off by two online loan companies. Until i read about:Le_Meridian Funding Service  (lfdsloans@outlook.com / lfdsloans@lemeridianfds.com) somewhere on the internet, Still wasn't convince because of what i have been through until a relative of mine who is a clergy also told me about the ongoing loan scheme of LFDS at a very low interest rate of 1.9%% and lovely repayment terms without penalty for default of payment. I have no choice than to also contact them which i did through text +1-989-394-3740 and Mr Benjamin responded back to me That day was the I'M best and greatest day of my life which can never be forgotten when i receive a credit alert of $400,000.00 Usd loan amount i applied for. I utilized the loan effectively to pay up my debts and to start up a business and today i and my kids are so happy and fulfill. You can as well contact them through email: (lfdsloans@outlook.com / lfdsloans@lemeridianfds.com)  WhatsApptext  helpline: +1-989-394-3740 Why am i doing this? I am doing this to save as many that are in need of a loan not to be victim of scams on the internet. Thanks and God bless you all, I'm Oleksander Artem from Horizon Park BC , Ukrain.

    ReplyDelete

Breaking News
Loading...
Quick Message
Press Esc to close
Copyright © 2013 Technology KB All Right Reserved