Monday, January 30, 2012

N:N (many to Many) Relationship in MS CRM 2011

N:N (many to Many) Relationship in MS CRM 2011 is good feature to build up direct relationship from UI.
This is a good link to go through it. http://www.dynamicscrmtrickbag.com/2011/05/08/many-to-many-relationships-in-dynamics-crm-2011/

If we are going through system N:N relationship, how can we bind records by through CODE?
its the same way as we used to do with 1:N and N:1.
System also used to take the help of the intermediate entity which keeps the GUID from the both main entities.
Suppose we want to create an N:N relationship between new_EntityA and new_EntityB.
So the system will create an intermediate entity called new_new_EntityA_new_EntityB (this can be renamed), this will contain its own guid as well as guid of other two entities new_EntityA and new_EntityB.

So if we want to create N:N relation then just put the EntityReference of new_EntityA to new_new_EntityA_new_EntityB and new_EntityB to new_new_EntityA_new_EntityB .

Actually internally, the system builds 1:N relationship from new_new_EntityA_new_EntityB to new_EntityA and again 1:N relationship from new_new_EntityA_new_EntityB to new_EntityB.
So there is a relationship of N:N from new_EntityA to new_EntityB.

thanks,
yes.sudhanshu

No comments:

Post a Comment