At this point, we all know the importance of using Virtual Tables or Virtual Entities in Dynamics 365 Finance and Operations apps. Perhaps one of the most common and well-known uses is leveraging Dynamics 365 F&O as a data source in Power Apps (specifically canvas apps) without the need to store data in Dataverse, thus avoiding the associated storage overhead. However, recently, these virtual entities have become crucial in various functionalities. Let me list some of them for you:
- Accessing F&O Data from Power Apps, Power Automate, and Power Pages via the Dataverse Connector
- Consuming Business Events (using the Dataverse connector in Power Platform)
- Consuming Data Events (reacting to CRUD operations in F&O)
- Performing CRUD Operations via the Dataverse API
- Copilot for Finance and Operations
- Data Archiving with Dataverse LTR
- Reporting and BI with Synapse Link for Dataverse
As you can see, there are numerous ways to utilize these virtual tables. However, the challenge lies in the activation process. While it’s not overly complex, it can be somewhat laborious and manual, especially if you need to activate dozens of these entities (a process that takes time and requires handling them one by one).
Certainly, you could automate this process using the Dataverse API (ultimately, it involves updating a record in the Available Finance and Operations Entity table, which is virtual). Alternatively, community-created tools like Finance and Operations Virtual Entity Manager for XrmToolBox by David Rivard can simplify the task. But here’s the exciting part: Microsoft has introduced a new feature in version 10.0.39 that allows automatic activation of virtual entities without the need for manual steps. Curious about how it works? Let’s dive in! 😊
Dataverse Auto Create Property
Starting from version 10.0.39, there is a new property (actually 2) at the Data Entity level. These properties are part of the Dataverse group. The properties are called Auto Create and Is Search Enabled.
The Auto Create property, as you might imagine, allows us to activate the entity within the list of virtual entities in Dataverse by simply setting it to Yes. This property can be enabled for both custom entities and standard entities through an extension.
On the other hand, Is Search Enabled will allow our virtual entity to be searchable using Dataverse search. However, it can only be enabled if our entity has the Allow Row Version Change Tracking property set to Yes. Keep in mind that there are known limitations for this property. You can find more information about Dataverse search in this link.
Database Synchronization
Once enabled, we proceed to compile and synchronize. It’s during this synchronization process that the magic happens. A new event handler runs after entity synchronization and schedules the batch job executed by the CDSVirtualEntityRefreshBatch class.
Executing this batch will mark our entity as Update Required in the form found under System Administration” > Inquiries> Virtual Entity > Virtual entity metadata sync status.
Subsequently, a new batch will be created to execute the CDSVirtualEntityAutoCreateBatch class, which connects to the Dataverse instance linked to our environment and activates our entity
After this process is complete, we can go to Dataverse and verify that our virtual entity is indeed available for use from any element within the Power Platform or via the Dataverse API.
Conclusion
Microsoft’s efforts to integrate Microsoft Dynamics 365 Finance and Operations into the Power Platform are becoming increasingly evident. In this case, they provide a useful automation that allows us to skip certain manual and tedious steps. What intrigued me the most while writing this article wasn’t just showcasing the functionality itself (which is quite straightforward), but delving into the code. Exploring classes like SysDataverseUtility and the ones mentioned in the post sheds light on how we can perform operations on entities within the linked Dataverse environment. If you’re curious, I encourage you to spend some time reviewing this code.
Important note
This process is available only in UDE or T2+ environments within the following versions:
- Auto Refresh: PU62 (7.0.7120.170), PU63 (7.0.7198.123), PU64 (7.0.7279.31), or later.
- Auto Create: PU63 (7.0.7198.123), PU64 (7.0.7279.31), or later.
And is also dependent on the activation of the following Flights:
- CDSVirtualEntityAutoRefresh.2
- CDSVirtualEntityAutoCreate.2
- CDSVirtualEntityAutoDelete
Therefore, you’ll need to enable them in the SysFlighting table of your environment for it to work.
Thank you for the hint! Great article with the review of such important and helpful feature. It was always a boring job to activate virtual tables on the environment manually.
Thanks Valery!