If you have not heard of the virtual entities for a while, it’s understandable. Sometimes, it seems there were no new developments on that front for a while now.
And, yet, it might not be quite fair, so, it seems, I’m going to write a few posts on this topic (not that I like writing series, but there might be just too much for a single post )
I’ll start with the problem at hands.
Imagine there is a huge amount of data stored in the SQL database, and imagine you need access to that data in your model-driven application. You don’t necessarily need all that data to be updatable, though you might need to have the ability to update a few fields here and there.
One way to do it will be to bring over all that data right to the Dataverse, but that would involve lots, and I mean lots of data synchronization. Is it doable? Probably. But, of course, with the current licensing model where all API calls are counted, and where Dataverse storage space can be quite expensive, that’s just going to be it… expensive.
However, this is exactly what Virtual Entities were created for. They have never gotten to the point where they’d support full set of CRUD operations, at least yet. And you may think they are heading towards deprecation because of how little we’ve heard about them lately. But have a look here:
https://docs.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/power-platform/overview
Microsoft is, actually, relying on them quite heavily for integrations. So, why don’t we do the same?
CRUD might be a bit of a problem, but here is what I have in mind:
See, Embedded Canvas Apps are supported on the model-driven forms, and that is also true for the virtual entity forms. So, if we wanted to update a virtual entity which is sources from SQL… we could just use an embedded canvas app.
Of course there is more to it.
- We need to create a virtual entity
- We need to write a custom data provider
- We need to create an embedded canvas app
As I mentioned at the beginning of this post, it may take a few posts to write about it. But here is a teaser so far.
- You’ll see how we can search for a “virtual record” right in the model-driven application view
- We can use virtual entities in the lookups
- We can update those virtual records through an embedded canvas app
All the data for “Frodo”, “Gandalf”, etc is coming directly out of the SQL database.
In the next post, you will find step-by-step instructions on how to set it up, including custom provider source code:
And, then, you’ll see how to use embedded canvas app to add “update” functionality to the virtual entity: