web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Blogs / Its about D365 / D365 Custom Data Provider f...

D365 Custom Data Provider for Virtual entities

Srujan K Profile Picture Srujan K 317

One of the differentiating features in Dynamics 365 9.0 is Virtual Entities, and these are driven by Virtual Entity Data Sources and Data Providers.

Virtual Entities acts as a facade to external data into the system as if the data were present in the CRM.

Currently Dynamics 365 9.0 provides 'OData V4' Web API as one of the data provider and  COSMOS DB Data Provider in the app source. Apart from these Dynamics 365 9.0 gives us the flexibility to create our own data provider using which we can invoke our own APIs.

Below is the step by step approach to create D365 Custom Data Provider

1.     Create an Assembly with Retrieve Multiple and Retrieve Plugins. (Sample code is available here for creating this.)

2.     Register Assembly on the CRM Org using the 9.0 version of Plugin Registration Tool , for the below demonstration i have used 9.0.0.7 version of PRT

1.png

3.     Create a solution with a desired name and publisher, For the demonstration purpose i have given the name as 'POC'. This would be used in the further steps.

2.png

4.     Open the Plugin Registration tool again. Navigate to 'Register' and click on the option ‘Register New Data Provider’ from the drop down.

3.png

5.     Fill the details as shown below, Choose the above created solution ( 'POC' in this case')  and choose the assembly u have created in the previous steps ( my assembly is 'POC.CustomDataProvider.dll'  and it has the definition for both Retrieve and Retrieve Multiple Plugins), Also select the 'Retrieve' and 'Retrieve Multiple' plugins from the corresponding drop downs.

4.png

6.     Create a new Data Source Entity and click on create from the Data Source Entity field.5.png

7.     You would get an exception ( product issue) as below or The PRT could crash as well ( in that case just repeat the process). If it is Just an exception click ‘OK’. 

6.png

8.   Click on Register, Once all  the details are filled.

7.png

9.      Go back to CRM and navigate to the previously created Solution ( ‘POC’ in this case).  You will find a new Entity with the name given in the Data Source ( 'POC Data Source' ) in the solution.

10.  In this step we will have to verify the newly created Data Source Entity and update if this Entity fields are populated with 'External Name'.

 a)By Default, CRM creates 2 fields ( ‘poc_name’ and ‘poc_datasourceid) and the  Entity Main form has only 'Name' field displayed on it. 

b)Customize this entity with the fields and the form in line with your requirement . I have created a Custom SQL Data Provider from,  So I have customized the Entity for Data Source accordingly. The customization involves creation of additional Fields and adding the fields on the Form like below. There is an option -'Data Source secret' for the custom fields you can mark the field as Yes if you want the field data to be hidden

c)Make sure that the external names are populated for all the fields and for convenience sake give the schema names of the fields as 'External name' for all the fields.

d)'Publish all Customizations' in the solution.

9.png

11. Navigate to Settings -> Administration and create a new Data Source  and choose the Data provider created in the above steps. You would be using in your Virtual entities.

8.1.png

12.  Navigate to the Solution and Create a new Entity with the check box checked for 'Virtual Entity' with the above created Data Source and map the Virtual Entity fields  'External names' with schema name of the Custom Data Source.

13.PNG

14.PNG15.PNG

13.  Once Solution is Published, Go to Advance find and Retrieve your Virtual Entity, you should be able to see results.

14. Click  here to get the sample code for creating the Plugin. Read more

Comments

*This post is locked for comments