Understanding Intersect Entities and Bridge Entities in Dynamics 365

 

Understanding Intersect Entities and Bridge Entities in Dynamics 365

Introduction

When working with Dynamics 365, the term 'Intersect Entity' might come up when dealing with N:N relationships between entities. This article aims to explain what an Intersect Entity is, how to find its schema name, and how to query it using tools like XrmToolbox.

What is an Intersect Entity?

An Intersect Entity is a hidden entity created behind the scenes when you establish an N:N relationship between two entities in Dynamics 365. This entity stores the associations between records of the two related entities.

How to Find the Schema Name of an Intersect Entity

  1. Navigate to Settings: Open your Dynamics 365 instance and go to the Settings area.
  2. Access Customizations: Click on Customize the System.
  3. Select Entity and Relationship: In the solution explorer, expand the entity involved in the N:N relationship and click on N:N Relationships.
  4. View Relationship Properties: Locate the relationship and click on it. The schema name of the intersect entity will be listed under the "Relationship Entity Name" field.

Querying Intersect Entity Using XrmToolbox

While you can't usually access the intersect entity using Advanced Find, you can query it using XrmToolbox.

  1. Open XrmToolbox: Launch the XrmToolbox application and connect it to your Dynamics 365 instance.
  2. Select Plugin: Choose a plugin that allows you to execute FetchXML queries, such as the "FetchXML Builder".
  3. Enter Query: Use the schema name you found to construct your FetchXML query to retrieve records from the intersect entity.
  4. Execute Query: Run the query to view the records linking the two entities in your N:N relationship.

Intersect Entity vs Manually Created Bridge Entity

When is an Auto-Generated Intersect Entity Sufficient?

An auto-generated intersect entity is suitable for straightforward many-to-many relationships where no additional information needs to be stored about the relationship itself. In this case, Dynamics 365 automatically handles the association between records from both entities.

For example, below are all fields of an intersect entity "adx_eventsponsor_event" between "adx_event" and "adx_eventsponsor".



When to Consider Creating a Manual Bridge Entity?

You might consider creating a manual bridge entity if you have specific business requirements that cannot be met with the default intersect entity, such as:

  • Storing additional attributes for each relationship.
  • Complex querying or data manipulation.
  • Enhanced security roles that apply to the relationship entity.

Differences

The key differences between an auto-generated intersect entity and a manually created bridge entity are:

  • Attributes: A manual bridge entity allows for extra attributes, while an auto-generated intersect entity does not.
  • Flexibility: Manual bridge entities offer more flexibility in querying and data manipulation.
  • Security: Manual bridge entities can have their own security roles, unlike auto-generated intersect entities.

Conclusion

Understanding the role and functionality of Intersect Entities, also commonly known as Bridge Entities, is crucial for managing N:N relationships in Dynamics 365 effectively. While the system can automatically handle these relationships through auto-generated intersect entities, there are scenarios where a manually created bridge entity may be necessary. These manual bridge entities offer more flexibility, the ability to store additional attributes, and the possibility to apply specific security roles. Knowing when to use each type is key to optimizing your data relationships in Dynamics 365.

No comments:

Post a Comment