MSBA-342 · Lesson 7 of 12 · 20 min
Virtual entities
▶ Video coming soon A video version of this lesson is on the way.
Henrik Salo's field technicians had asked for one thing since the first functional sessions: a phone app that showed, for any pump they were standing next to, its warranty, its install date, and whether a claim was already open. The technicians were not finance and operations users and never would be. They worked in Microsoft Teams and in two small Power Apps that a maker in Henrik's team had built on Dataverse. The tender pilot from the last clinic had a similar need: read customers and products, occasionally create a prospect. After the dual-write clinic, the decision log said that both needs would be met with virtual entities. This clinic built the first one.
Virtual entities are the lightest way to connect Dataverse and the Power Platform to finance and operations data. Nothing is copied. Dataverse presents a table that looks and behaves like any other Dataverse table, but every read and write is passed through to the finance and operations data entity behind it, in real time, as the signed-in user.
How virtual entities work
A virtual entity, called a virtual table in current Power Apps terminology, is a Dataverse table whose data lives in another system. For finance and operations apps, Microsoft provides a virtual entity data provider that treats the finance and operations environment as a virtual data source. Microsoft Learn describes the requirements as finance and operations apps version 10.0.12 or later with Dataverse service update 189 or later, and every OData-enabled data entity can be made available as a virtual entity. The provider supports the full set of operations: create, update, delete, retrieve, retrieve multiple, and perform action, which calls an OData action on the entity.
When a Power App or a flow queries the virtual table, Dataverse turns the query into a call to a web API in finance and operations apps, which translates the Dataverse query into the application's own query constructs and runs it through the data entity. Because the entity itself runs, all of its business logic and the logic on its backing tables run too, exactly as they would for an OData call. Microsoft states that when both environments are in the same Azure region, the added overhead is expected to be under thirty milliseconds per call.
Security runs as the user
Security is the feature that makes virtual entities safe for wide use. Calls between Dataverse and finance and operations apps use a Microsoft Entra application, but that application is granted almost nothing on its own: the standard role it holds gives access only to the adapter web API and the catalog of available entities. Every data operation runs in the context of the Dataverse user who made the request, mapped to the matching finance and operations user. If a technician has no role in finance and operations apps that grants the view privilege on the warranty entity, the technician sees nothing, however the app is built.
That rule had a practical consequence for Cobalt Ridge. The technicians needed finance and operations user accounts with a narrow role, even though they would never open the finance and operations client. Desmond created a role, CR Field technician warranty inquiry, containing the warranty entity view privilege and the privilege for the void action, and Thandeka checked the licence implications with the partner before the role went into the security design. Microsoft's documentation also notes that a missing or improper user context produces errors such as being unable to determine the user, because the Dataverse system user and the out-of-box service applications do not have access to every entity.
Making an entity available
Virtual entities are installed with the finance and operations virtual entity solution in Dataverse, which arrives when the Power Platform integration is enabled for the environment, as it is in every unified developer environment and every environment created through the Power Platform admin center. Installing the solution does not create a virtual table for every entity. Instead, Dataverse holds a catalog of the available finance and operations entities, and an administrator or developer marks the ones needed as visible. Dataverse then generates the virtual table, with a name made from the mserp prefix and the entity's name in lower case, and a column for each entity field.
Make CRPumpWarrantyEntity available in Dataverse (unified developer environment)
1. Confirm the entity is Public with a public collection name (lesson 1)
and that the build is deployed.
2. In Dataverse, open the catalog table of available finance and operations
entities (Advanced find or a model-driven view over it).
3. Find CRPumpWarrantyEntity. If it is missing, run Refresh on the catalog.
4. Set Visible = Yes and save. Dataverse generates the virtual table:
logical name mserp_crpumpwarrantyentity
columns mserp_serialnumber, mserp_itemid, mserp_customeraccount,
mserp_installdate, mserp_warrantymonths, mserp_status, ...
5. Add the virtual table to the solution CobaltRidgeFieldApps so it moves
to UAT and production with the apps that use it.When an entity changes, for example when a field is added, the virtual table must be refreshed so that Dataverse picks up the new metadata. In application lifecycle terms, virtual tables are added to Dataverse solutions like any other table, which carries them from the developer environment to UAT and production. Microsoft's guidance on application lifecycle management for virtual entities explains that the virtual table definition in the solution refers to the entity by name, so the entity must exist and be deployed in the target environment before the solution is imported there. Desmond added that dependency to the release checklist: deploy the finance and operations package first, then import the Dataverse solution.
Building the technician app
With the virtual table in place, the maker in Henrik's team could build the technician app without writing X++. The canvas app's main screen had a barcode scanner control that read the serial number plate on a pump, and a gallery filtered on mserp_serialnumber. The detail screen showed install date, end date, status and the customer's name, all coming from the entity, all calculated by Cobalt Ridge's own code. Because the end date was read only on the entity, the app could not change it. Because the entity's validateWrite applied the shipped-to-customer rule, the app could not register a warranty against the wrong distributor, even though nobody had told the maker about that rule.
The technicians also needed to void a registration made in error, the same operation the Prairieline portal used. In Dataverse, OData actions on a virtual entity are exposed as actions that a flow or app can call, which the provider maps to its perform action operation. The maker built a small Power Automate flow, started from the app, that called the void action with a reason. Prudence did not write a single extra line of code for the technician app; the entity and its action from the first two clinics did all the work.
Limits and performance
Virtual entities are live calls, so their performance is the performance of the entity. A gallery that loads five hundred warranties with every column calls the entity once for each page of results and reads every field. Desmond gave the maker three rules. Filter on indexed fields, such as serial number and customer account, and avoid filters on calculated or virtual fields. Show only the columns the screen needs, because Dataverse requests only the columns in use. And avoid joining virtual tables to native Dataverse tables in large views, because the join is done by Dataverse after it has fetched both sides.
Some Dataverse features work differently on virtual tables. Because no rows are stored, features that depend on stored rows need special support. Change tracking is one example: Microsoft provides a preview feature, available from version 10.0.31 with the Power Platform integration enabled, that lets Track changes be turned on for a finance and operations virtual table. It relies on row version change tracking on the entity and its tables, which lesson 9 explains in detail because the analytics features depend on it. Other features, such as offline use of virtual tables in mobile apps, have their own requirements, which Desmond asked the maker to check on Microsoft Learn for each feature the app planned to use.
| Feature | Virtual entity behaviour |
|---|---|
| Read, create, update, delete | Supported, through the data entity |
| Business logic | Entity and table logic in finance and operations apps runs |
| Security | Runs as the signed-in user mapped to a finance and operations user |
| OData actions | Callable through the perform action operation |
| Track changes | Preview from 10.0.31; requires row version change tracking |
| Storage in Dataverse | None; data stays in finance and operations apps |
Virtual entities and other Power Platform features
Once a finance and operations entity is a Dataverse table, much of the Power Platform can use it in the standard way. Model-driven apps can show it in views and forms. Power Automate can use the Dataverse connector to list and update its rows. Copilot Studio agents can use it as knowledge or in actions, within the same security as the signed-in user. Desmond was careful to tie that last point back to Cobalt Ridge's rule from the earlier courses: agents may draft or submit, never post. An agent that read warranties through the virtual table and drafted a claim was within the rule; one that posted a credit note was not.
The tender pilot used the same approach with standard entities. The pilot app needed customers and released products, both of which had standard OData entities. The maker made the customer and released product entities visible, added them to the pilot's solution, and replaced the pilot's own copies of customer data with lookups to the virtual tables. The pilot's data quality problems, mostly duplicate customer names keyed by hand, disappeared, because there was now only one customer list.
Virtual entities compared with the other patterns
By this point in the series, Prudence could reach the warranty entity five ways: through the form, through data management, through OData, through a custom service operation and through a virtual table. Desmond asked her to say in one sentence when each was right. Her answer for virtual entities was the one that went into the register: use them when a Power Platform app or flow needs live access to finance and operations data as the signed-in user, and no copy of the data is required. When a copy is required, consider dual-write; when bulk movement is required, use data management; when another system should be told about a change, use a business event.
Designing entities for virtual use
Because virtual tables expose entities to makers who do not know the data model, the entity design choices from the first clinic matter even more here. Field names become column names that makers see, so they should be clear business names. Read-only fields stay read only in Dataverse, which protects calculated values. Enums become choice columns, so their labels should read well. And the entity key matters again: Dataverse gives every virtual table row a unique identifier for its own purposes, but makers search and filter by the business key, so an index that starts with the key fields keeps those searches fast.
Desmond added one more rule for custom entities intended for virtual use: keep a separate entity when the audience is very different. The distributor entity from the OData clinic carried customer name and product name for the portal. The technician app wanted the same warranty plus the most recent claim status and the name of the installer, which the portal did not need. Rather than widen the shared entity until it served everyone badly, Prudence created a second, read-only entity, CRPumpWarrantyFieldEntity, with exactly the fields the technicians needed and a computed column for the days of warranty left. Two small entities were easier to secure, faster to query and easier to change than one large one.
Lifecycle across environments
Desmond walked Prudence through the full path of a change that touches both systems. Suppose the technicians ask for the pump's motor serial number. Prudence adds the field to the field entity in X++, builds, deploys to her environment, refreshes the virtual table in her Dataverse environment, and the maker adds the column to the app. For release, the X++ change goes through a pull request and the build pipeline into a deployable package; the Dataverse solution with the refreshed virtual table and the updated app goes into the CobaltRidgeFieldApps solution. In UAT, the package is deployed first and the solution imported second. The same order applies in production. If the order is reversed, the solution import finds a virtual table definition that refers to a field the entity does not yet have.
Kiri asked whether this coordination would slow every release. In practice it added one line to the release checklist and one owner, the person who imports Dataverse solutions, to the release meeting. The benefit, one copy of the data and the same business rules everywhere, outweighed that cost by a wide margin.
Worked problem
Diagnosing an empty gallery
The technician app works for the maker but shows an empty warranty gallery for a technician who signed in for the first time. The app and the virtual table are the same for both. What should Prudence check?
Show solution
- Virtual entity calls run as the signed-in user, so the technician's own access matters, not the maker's.
- Check that the technician's Dataverse user maps to a finance and operations user, which requires that user to exist.
- Check that the finance and operations user holds the CR Field technician warranty inquiry role, with the view privilege on the entity.
- Check that the role gives access to the right legal entities, since warranties are company-specific.
Answer: The technician lacks a mapped finance and operations user or the role and companies needed. Create or fix the user and role; the app itself is fine.
Common mistakes
MistakeAssuming the app's service account decides what users see.
InsteadVirtual entity calls run as the signed-in user; give each user the right finance and operations role.
MistakeImporting the Dataverse solution before deploying the finance and operations package.
InsteadDeploy the entity first, then import the solution that refers to it.
MistakeFiltering a large gallery on a virtual field.
InsteadFilter on indexed stored fields and show only the columns the screen needs.
MistakeCopying data into Dataverse when live reads would do.
InsteadUse virtual entities for live access and keep a single copy of the data.
Summary and key terms
- Virtual entities present finance and operations data entities as Dataverse tables without copying data.
- The provider supports create, update, delete, retrieve, retrieve multiple and OData actions, and runs entity logic.
- Every call runs as the signed-in Dataverse user mapped to a finance and operations user.
- Entities are made visible from Dataverse's catalog of available entities and appear with the mserp prefix.
- Deploy entities before importing the Dataverse solutions that use them, and design apps for live-call performance.
- Virtual entity
- A Dataverse table whose rows live in finance and operations apps and are read and written through a data entity.
- Virtual table
- The current Power Apps name for a virtual entity.
- Virtual entity data provider
- The component that translates Dataverse requests into finance and operations data entity calls.
- Visible flag
- The setting in the catalog of available entities that generates a virtual table for an entity.
- mserp prefix
- The prefix on the names of finance and operations virtual tables in Dataverse.
- Perform action
- The provider operation that calls an OData action on a finance and operations entity.
Practice problems
Work each problem on paper first, then reveal the answer to check.
Why did the technician app enforce the shipped-to-customer rule without any code in the app?
Show answer
Because the virtual table calls the data entity, whose validateWrite contains the rule.
What must exist in the target environment before a solution containing a virtual table is imported?
Show answer
The finance and operations entity, deployed in the linked environment.
What feature lets Dataverse track changes on a finance and operations virtual table, and what does it require?
Show answer
Track changes for virtual tables (preview from 10.0.31), which requires row version change tracking on the entity and its tables.
Lesson quiz · 5 questions
Score 60% or more to complete this lesson.
Create a free account to save your progress, take quizzes and earn a certificate.