Virtual entities were introduced in Dynamics 365 (Online) version 9.0. Virtual entities sound quite futuristic but put simply they enable integration of data stored in external systems without the need of custom code and data replication. This blog describes the benefits of using virtual entities, how to use them and what to think about when using them.
The first release of virtual entities only allows Read-Only access to the data and there are a few other limitations which I have been detailed here in this post.
Key Benefits of Virtual Entities in Dynamics 365
- There are no physical tables created in the database to store the data. The data is retrieved dynamically as and when it’s needed allowing for a reduction in storage space, therefore, reducing monthly CRM storage costs. Please note as it currently stands in the Microsoft Dynamics 365 licensing guide for Online (October 2018) as standard you will get 10GB. For every 20 full plan users, you will receive an extra 5GB.
- No code is required to display the external data in CRM, which reduces project costs and time.
Limitations
The initial release of virtual entities does, unfortunately, come with some limitations. These limitations should be considered to evaluate the use of virtual entities.
These limitations are:
- The data displayed within the virtual entity is read-only. This means that if a user updates the data the data cannot be pushed back into the external system.
- Only Organization owned virtual entities are supported in the current release. When creating a new virtual entity you must ensure that the ownership dropdown is set to Organization rather than User or Team as per the image here taken from Microsoft Dynamics 365.
- Please note that Field Level Security is not supported in the current release.
- If the virtual entity has been set up with ‘User or Team’ ownership then any associated security role settings for the entity are not supported.
- Auditing of the Virtual Entity is not supported in the current release and instead will be required to be implemented within the external database.
- Downloading the data to use offline isn’t supported at this time. This means that data isn't visible when working offline.
- Virtual entities cannot be configured as an active entity.
- Business Process Flows are not supported.
- Queues cannot be set up for records within the virtual entity.
- Once the virtual entity has been created it cannot then be changed back to a standard CRM entity.
Data Modelling
A further consideration to be made when using virtual entities is data modelling. The data which is held in the external data store must follow these rules:
Each entity within the external data source needs to have a GUID Primary Key associated with it. This GUID is used as the Primary Key in the virtual entity in Dynamics 365.
You must be able to display the external data properties as Dynamics 365 attributes, this also applies for all entity relationships. These attributes include
- Numbers
- Single Line of Text and option sets
- Lookups
- Date & Time
As the data in the virtual entity is read-only, calculated and rollup fields are not available. If any calculations or rollups are needed these will need to be executed in the external data source.
How to create a Data Source
To create a new data source firstly go to Settings > Administration > Virtual Entity Data Sources. From here click New in the toolbar, you will be prompted to select a Data Provider. The two options here are:
- OData v4 Data Provider or
- Solutions Component Data Provider
Select the appropriate Data Provider then click OK. A new window will now appear for you to enter the Data Source information. For the purpose of this blog, I have selected OData v4 Data Provider. Populate the Name and enter the URL then add any additional Parameters as necessary. Click Save & Close, you will now be able to use this Data Source when creating new Virtual Entities.
How to create a Virtual Entity
Virtual Entities can be created in the same way other entities are normally created however there are a number of additional steps which need to be fulfilled which I have listed here:
- Navigate to Settings > Customizations > Customize the System
- Select Entities in the pane on the left and click New
- Populate the entity details as standard making sure that the following items are populated:
- Virtual Entity tick box - this needs to be ticked in order for the entity to become virtual. This cannot be ticked once the entity has been created so be sure to tick before clicking Save.
- Data Source drop-down - this will display a list of all Data Sources that have been created in the system. Select the appropriate Data Source, if left blank no data will be pulled through into the entity.
- External Name – Populate this with the name of the matching table in the external system.
- External Collection Name – Populate this with the plural name of the matching table in the external system.
Here is an example of a virtual entity for Suppliers which uses an OData v4 feed to pull in the information.
the screenshot was taken from a Microsoft Dynamics 365 site.
- Now you can start creating the fields needed to display the information in D365. When creating the fields ensure the External Name is populated with the matching field name from the external system.
- Save and publish all changes
- A refresh of CRM may be needed for the entity to display in the Sitemap. Once CRM has reloaded you can navigate to your newly created virtual entity to confirm the data is being pulled into CRM.
Want to learn about other new features in Dynamics 365? Check out our new blog about
This blog was written by Luke Judge a technical CRM specialist at