Posts

Solving Dataverse Concurrency Issues Using Azure Service Bus Queue and Azure Functions

Concurrency issues are one of the most common challenges when building high-volume solutions in Microsoft Dataverse . The problem becomes even more visible when multiple transactions attempt to update the same record simultaneously. Although Dataverse provides optimistic concurrency support, many real-world implementations still experience: race conditions overwritten values inconsistent totals API throttling Service Protection limits In this post, we will understand how Azure Service Bus Queue and Azure Functions can help solve these issues in a scalable and reliable way. The Business Scenario For this demo, two custom tables are used: Contact Stores: Total Points Order Point Stores: Transaction Date Points Balance Points Contact The requirement is: Maintain accurate Contact.TotalPoints while also adjusting Order Point.BalancePoints based on point usage. The rule is: SUM(OrderPoint.Points) = SUM(OrderPoint.BalancePoints) = Contact.TotalPoints...

Understanding Historical Field Updates in Microsoft Dataverse: CreatedOn, CreatedBy, ModifiedOn, and ModifiedBy

 When working on data migration projects in Dynamics CRM / Dataverse, one of the most common requirements is preserving historical data such as: Created On Created By Modified On Modified By At first glance, it may seem straightforward to set these fields using the CRM SDK. However, many developers quickly discover that some values are ignored while others work only in specific scenarios. This blog explains the behavior of these system fields across different execution contexts and clarifies when Dataverse allows overriding them. Why This Matters In most enterprise migration projects, business users expect migrated records to retain original audit history from legacy systems. For example: Field Expected Historical Value Created On Original record creation date Created By Original creator Modified On Last modification date from source system Modified By Last modifier from source system Many developers attempt to achieve this directly through SDK operations, only to find inconsistent...

Understanding FakeXrmEasy Test Flow in Dynamics 365 CRM

  Why We Add Entities to MergeSalesOrdersBase When writing unit tests for Dynamics 365 CRM plugins using FakeXrmEasy, one of the most confusing concepts is: Why do we need to add entities into _entities when we already use .ToEntityReference() ? This article explains the complete testing flow step by step. The Real Problem Suppose you have a Sales Order: var salesOrder = new SalesOrder { new_ContosoSalesOrderType = ContosoSalesOrderTypes . AcknowledgementTrue . ToEntityReference () }; At first glance, it feels like the Sales Order Type already exists. But internally, that is NOT true. .ToEntityReference() only stores: Logical Name GUID Example: new_contososalesordertype GUID = 12345 It does NOT store the actual entity fields. So fields like: new_AllowSalesOrderAcknowledgments new_AllowMerging new_AllowSubstitutes are NOT available unless the entity itself is added into FakeXrmEasy. Understanding the Complete Test Flow Step 1 — Base Class Runs First Your test inher...