Export (0) Print
Expand All

Retrieve Records for Many-To-Many Relationships Using Intersect Entities

[Applies to: Microsoft Dynamics CRM 2011]

In Microsoft Dynamics CRM 2011 and Microsoft Dynamics CRM Online, when there is a many-to-many (N:N) relationship between two entities, an intersect entity is automatically created. This is true for both system relationships built into the product as well as custom many-to-many relationships. The name of the entity is specified in the IntersectEntityName property in the relationship metadata. The name of the relationship is specified in the SchemaName property in the relationship metadata.

You can use the intersect entities to refine the result set in any query by using the IOrganizationService.RetrieveMultiple method or the RetrieveMultipleRequest message. However, you cannot retrieve the intersect entity records directly by using the QueryExpression class. To retrieve the records in an intersect entity, you must use the FetchExpression class.

The following table lists the intersect entities that are used in N:N relationships between default entities.

 

Intersect entity name Relationship entity 1 Relationship entity 2 Relationships schema name

AccountLeads

Account

Lead

accountleads_association

CampaignActivityItem

CampaignActivity

List

SalesLiterature

campaignactivitylist_association

campaignactivitysalesliterature_association

CampaignItem

Campaign

Campaign

List

Product

SalesLiterature

campaigncampaign_association

campaignlist_association

campaignproduct_association

campaignsalesliterature_association

CompetitorProduct

competitor

Product

competitorproduct_association

CompetitorSalesLiterature

competitor

SalesLiterature

competitorsalesliterature_association

ConnectionRoleAssociation

ConnectionRole

ConnectionRole

connectionroleassociation_association

ContactInvoices

Contact

Invoice

contactinvoices_association

ContactLeads

Contact

Lead

contactleads_association

ContactOrders

SalesOrder

Contact

contactorders_association

ContactQuotes

Quote

Contact

contactquotes_association

LeadCompetitors

Lead

Competitor

leadcompetitors_association

LeadProduct

Lead

Product

leadproduct_association

ListMember

List

Account

Contact

Lead

listaccount_association

listcontact_association

listlead_association

OpportunityCompetitors

Opportunity

Competitor

opportunitycompetitors_association

ProductAssociation

Product

Product

productassociation_association

ProductSalesLiterature

Product

SalesLiterature

productsalesliterature_association

ProductSubstitute

Product

Product

productsubstitute_association

RolePrivileges

Privilege

Role

roleprivileges_association

ServiceContractContacts

Contact

Contact

servicecontractcontacts_association

SystemUserProfiles

SystemUser

FieldSecurityProfile

systemuserprofiles_association

SystemUserRoles

SystemUser

Role

systemuserroles_association

TeamMembership

Team

SystemUser

teammembership_association

TeamProfiles

Team

FieldSecurityProfile

teamprofiles_association

TeamRoles

Team

Role

teamroles_association

Intersect Entity Metadata

Most intersect entities are simple, containing just the few properties that are needed to provide a link between to two entities in the N:N relationship. If you are using early bound types, you can see an example, in the ContactInvoices intersect entity. This is the case for all custom many-to-many relationships. However, there are several intersect entities that have additional properties that are used for specific functionality for the relationship. To make it easier to write queries by using the special intersect entities, the attribute metadata is provided in the following topics:

See Also

Microsoft Dynamics CRM 2011
Send comments about this topic to Microsoft.
© 2013 Microsoft Corporation. All rights reserved.

Community Additions

ADD
Show:
© 2014 Microsoft