Master Dataverse: Unveiling the RelatedEntities Plugin
Image Source:
Microsoft Dataverse
Mar 9, 2024 8:34 PM

Master Dataverse: Unveiling the RelatedEntities Plugin

by HubSite 365 about Temmy Wahyu Raharjo

Citizen DeveloperMicrosoft DataverseLearning Selection

Unlock Dataverse Potential: Master RelatedEntities for Optimal Performance

Key insights



  • Dataverse plugins enhance performance through customization.
  • RelatedEntities plugin operates differently with CreateMultiple versus normal creation.
  • Performance can be improved by optimizing how plugins handle entity relationships.
  • Parent and child entities have a specific creation order, impacting data handling.
  • The system treats each row creation individually, contrary to expectation.

Understanding Dataverse Plugins and Their Impact on CRM Performance

Plugins in Dataverse are powerful tools for customizing and enhancing the performance of CRM systems. Specifically, the RelatedEntities plugin showcases how it can handle entity relationships differently, offering potential performance improvements. A key insight from experimenting with these plugins is the distinct behavior between using CreateMultiple versus normal creation methods. This difference affects how customization can be approached to optimize CRM performance.

Furthermore, the sequence in which parent and child entities are created plays a critical role in how data is managed and utilized within the system. Interestingly, despite initial expectations, the system processes each row individually during creation. This behavior underscores the need for developers to carefully consider how their custom logic is applied, especially when dealing with collections of entities. The exploration of these plugins not only highlights opportunities for performance optimization but also sheds light on the underlying mechanics of entity creation and relationship handling in Dataverse.



Read the full article Dataverse: How the RelatedEntities Plugin Works



Dataverse: How the RelatedEntities Plugin Works Last week, Temmy Wahyu Raharjo learned how the RelatedEntity’s performance compares to normal creation. We will create plugins for today’s blog post and inspect how it works. For the side topic, Temmy Wahyu Raharjo will also cover CreateMultiple and see if Temmy Wahyu Raharjo can make the customizations better in terms of performance. Let’s go! Here are the plugins that I’ll cover here:

  • using Microsoft.Xrm.Sdk;
  • using Microsoft.Xrm.Sdk.Extensions;
  • using Microsoft.Xrm.Sdk.Query;
  • using System;
  • using System.Linq;

If you are wondering what I’m doing on the above plugins, essentially what I want to prove are: MultipleCreate vs Create. Which one will trigger first? If MultipleCreate can be used with the RelatedEntities. So Temmy Wahyu Raharjo can have options to make the performance better (instead of relying on logic on Create, Temmy Wahyu Raharjo can have options to call the logic once in CreateMultiple). Parent vs Child, which one will be created first Once the above plugins are deployed to my environment. Then I created the necessary steps: Plugin steps registered

  • Again, I’m using exe to trigger the creation of the entity:
  • Trace Log that shows that PreCreateChild running first compared to PreCreateMultiple
  • PreCreate operation will be run first, and only after that the PreMultipleCreate (please note that Microsoft will gradually force us to use the MultipleCreate instead of Create).
  • From the record itself also you can see that the “Number” is set as “PreCreateChild” first only “PostCreateChild“:

Summary I thought when using RelatedEntities, the system would run the CreateMultiple plugin once. But, in reality, this plugin will be called for each of the rows instead. Hence, if Temmy Wahyu Raharjo wants to have a collection logic, Temmy Wahyu Raharjo still needs to rely on calling the logic from outside of the plugin (e.g., after calling service.Create(contact) > only call the sum logic). The next observation on PreCreateChild or even when I tried to change it to PostCreateChild, Temmy Wahyu Raharjo couldn’t get the tmy_parent reference using target.GetAttributeValue(“tmy_parent”). Hope you learn something from this blog post! Happy CRM-ing!

Understanding Microsoft Dataverse and Its Impact

Microsoft Dataverse plays a crucial role in streamlining data management across business applications. It simplifies the process of storing and managing data securely and easily. The versatility of Dataverse enables developers to build powerful, interconnected applications using a common data model. Whether you're enhancing business processes with custom plugins or integrating data across various applications, Dataverse provides the flexibility and scalability needed to address complex business requirements. This platform also supports a vast ecosystem of Microsoft and third-party applications, making it easier to deploy solutions that align with business goals. By leveraging Dataverse, organizations can improve their data governance, quality, and consistency, which are essential for making informed business decisions. As Dataverse continues to evolve, it reinforces its position as a foundational component of the Microsoft Power Platform, empowering businesses to innovate and adapt in an ever-changing digital landscape.



People also ask

What are the limitations of Dataverse plugin?

In the case of Dataverse plugin operations, a strict 2-minute duration limit is imposed for completing any Dataverse message transaction. This specific timing constraint encompasses the entire execution process, including the execution of the primary message operation as well as any synchronous plug-ins that may be registered concurrently. Additionally, there are explicit restrictions concerning the CPU and memory resources that extensions are permitted to utilize.

What information can we get from plugin context?

The plugin context serves as a vessel for delivering vital contextual data to a plugin while in operation. It encompasses details that illuminate the runtime environment within which the plugin functions, particulars concerning the execution pipeline, and nuances of entity business data.

What is a Dataverse plugin?

A Dataverse plugin represents a form of custom business logic, crafted in .NET, designed to seamlessly integrate with Dataverse. This integration facilitates the triggering of various events, such as the creation, modification, or deletion of records.

How does the Dataverse work?

Dataverse operates as a cohesive data repository, amalgamating data from disparate sources into a singular storage framework. This consolidated data can then be employed across a range of Microsoft applications including Power Apps, Power Automate, Power BI, and Power Virtual Agents, in addition to exploiting the data accessible from the Dynamics 365 suite.



Dataverse RelatedEntities Plugin, RelatedEntities Plugin functions, Dataverse plugin techniques, understanding RelatedEntities in Dataverse, Dataverse coding plugins, how to use RelatedEntities Dataverse, Dataverse plugin development, optimizing Dataverse with RelatedEntities