How To Design Data Entity For Dual-write in Dynamics 365 Finance & Operations
Testing The Waters Is Better Than Drowning in the Pool! isn't it so? π
Long story short, there are two sets of Data entities in Dynamics 365 FO.
- Standard data entities
- Dual-write specific data entities (Postfix as CDSEntity)
The core purpose of having these categorizations is to manage, simplify & better control ALM, CE & ERP-related business scenarios, External party integration, or some processes that required some additional logic to be called to handshake with other downstream processes.
How Does It Work Under The Hood?
This is more about how data entities are designed in Dynamics 365 FO.
Dynamics 365 FO data entities are more complex since they encompass a wide range of data sources.
Furthermore, each data source could result in multiple tables. During a transaction, most processes should be performed within the context of the table, not within individual data entities.
A dual-write identifies whether a certain table is affected by a change on a certain form, for example, the customer form. When changing the customer form, changes are made to the customer table, addresses, and retail account tables.
As a matter of fact, it does not use the data entity, but rather it changes the table. Due to dual-write, this process recognizes that these two or three tables that have changed during the process relate to the CustCustomerV3Entity entity, and that they have all been modified to correspond to records in the CustTable entity.
In order to do this, it tries to find out table relations and determine what all final entities' records have been affected. In other words, the more maps or cross-data sources you have, such as DirPartyBaseEntity etc. In other words, databases are hitting the same type of record multiple times for different types of data.
Therefore, editing one global address book record could result in editing more than one entity, causing more than one entity on the Dataverse to be affected.
Thus, it is always recommended to create data entities as thin as possible from a Dual-write perspective.
It is worthwhile to use newly released light weight Data entities in the context of above scenario i.e., CustCustomerBaseEntity (Customer definitions), CustCustomerDetailV2Entity (Customer details V2)
What To Consider While Designing Dual-write Data Entities?
- Create a custom data entity with only the required data sources (tables) and enabled the required fields
- Remodel the Data entity in Dynamics 365 FO to remove unused data sources and tables or implement getEntityRecordIdsImpactedByTableChange to optimize the runtime queries
- Avoid using the same table which is being tracked by multiple data entities because any change to the table will trigger a Dual-write evaluation for the linked Data Entities
- In the event that point no. 3 is unavoidable due to business processes, you should consider simplifying the entity or evaluating query optimizations for data entities
- Read-only and outer join data sources should be removed since they cannot be tracked
- Data sources without any fields mapped should be removed, as these will not be tracked
- Data sources (tables) that are mapped must be registered with business events
Additional tips: πͺ
Dynamics 365 FO will trigger the changes only if the fields mapped to the records were modified. However, Dynamics 365 CE and Power Apps trigger all field modifications in Dual-write.
I hope this article was a good read for you. Do share it with your friends and other peers.
Thank you for Reading - Let's Connect!
Enjoy my blog? For more such awesome blog articles - follow, subscribe and let's connect on LinkedIn, Twitter, YouTube
Stay tuned!
Published on:
Learn moreRelated posts
Practical Hints for Technical Management of D365FO Go-Live
In this post, I share practical insights from my experience managing the technical side of Go-Live for D365FO projects, focusing on key activi...
D365FO Integration: Event-Based Exports to External Web Services
How to implement robust, efficient integrations between Dynamics 365 Finance and Operations and external Web Services. This post covers design...
Physical cost inclusion for Weighted Average Valuation in Microsoft Dynamics 365 Finance and Operations: Part-13
What is physical cost in Dynamics 365 F&O? Anything which has been received or shipped but not invoiced is considered as physical cost for...
Product bundles in Microsoft Dynamics 365 Finance and Operations
Product bundle was first introduced in module revenue recognition but as we all know the there is new modules which has been introduced and wi...
D365 Sending Email with Customer Account Statement SSRS report as attachment using X++
D365 Sending Email with Customer Account Statement SSRS report as attachment using X++ custTable _custTable; &...
clicking link on info message X++ to Open form
Message::AddAction() method can be used to embed an action within a message sent to the message bar. This method supports adding a singl...