With July update, one of the important features Microsoft has released was Virtual Entities. Virtual Entities allow us to show case data from a external data source in Dynamics CRM without migrating it into CRM.
By definition a virtual entity is an entity that does not have the associated physical tables for entity instances created in the Dynamics 365 database. Instead during runtime, it is dynamically retrieved from the associated external system. Each virtual entity type is associated with a virtual entity data provider and (optionally) some configuration information from an associated virtual entity data source.
Virtual entities are available for all Dynamics 365 (online) clients, and custom applications developed using the Dynamics 365 SDK.
Users can work with the records in virtual entity to view them in fields, grids, search results, and Fetch XML-based reports and dashboards.
Virtual entities can be created by configuring data source without writing code. This requires user to be System customizer.
Things to Consider:
- Virtual entity data is read-only
- Virtual entities are organization-owned.
- External data should have a GUID as ID field to be configured as a Virtual Entity.
- An attribute in virtual entity has to be created for every required field from external data source.
In this post, I will be using a Odata public service available to create virtual entity in Dynamics CRM. Please browse http://services.odata.org/V3/OData/OData.svc/$metadata#Advertisements and make sure this serves the purpose. ID filed should be of type Guid.Once the above step is complete, we are ready to add a provider in CRM. Navigate to Settings and Administration and then to Virtual Entity Data Sources.System will prompt us to select provider. At present we have only 1 provider as shown below.
Completing this step enables us to create a new virtual entity. Now Navigate to customizations and create a new Entity. In this window, you can provide display name and plural name as you wish. However, when virtual entity check box is selected, user need to enter External name and External Collection name. These two should match as per oData service. This wizard will also allow us to associate virtual data source created in previous step.
By default there will be 2 fields created when you create a virtual entity. ID and Name. Now, it is important to map external ID field to CRM ID field (GUID). We will also map external Name field to CRM name field. Please note that datatype should match.
Now add a new attribute in CRM and map to AirDate field. Set Field Requirement as BusinessRequired, External Name “AirDate” and datatype as Date Time.
Publish all customizations and now you are ready to view external data in Dynamics CRM.