Monday, April 17, 2023

Virtual entity Integration with Azure Database in MS Dynamics 365| Power Platform

Q. How to create Virtual Entity and integrate with External Data Sources like MS SQL/SharePoint?

You can see how the full video from below YT linkas well.


The whole process is divided into 3 parts/videos
1. Virtual Entity Mapping 
2. Creation of Azure Database and connecting in SQL Server Mgmt Studio PART 2
3. Integration into MS Dynamics 365 (Upcoming)

In D365 we have a  concept called a table, earlier it was called an entity.

An entity/table is a collection of fields that define a set of data and their relationships to each other. It’s the same as an SQL table. 

Both Dynamics 365 entities and SQL tables consist of a collection of fields/columns that define the data structure and a field/column has a data type like int, float, string, optionset, etc which specifies the type of data that can be stored in it. These Entities are used for data storage and management. 


A virtual table is a custom table in Microsoft Dataverse that has columns containing data from an external data source. Virtual tables appear in your app to users as regular table rows but contain data that is sourced from an external database, such as an Azure SQL Database. Virtual entities can be used to connect directly with an external data source like SharePoint or ms SQL without storing the data in CRM. They allow access and manipulation of data from these external sources within Dynamics 365 without replicating that data in the database.


In General, there are two types of entities on Dynamics 365- 


  1. System Entities: These are the default entities provided by Dynamics 365, such as Accounts, Contacts, Leads, Opportunities, and Cases. These entities are designed to meet common business requirements and come with pre-defined fields and relationships.


  1. Custom Entities: Custom entities are created by users to store data specific to their organization or business process. These entities are created based on the specific data requirements and can be used to model complex business processes.

Custom entities are categorized into two types i.e. Standard entity and Virtual Entity.

Whenever you create a table/entity, by default it will be considered a standard entity. So in order to create a virtual entity you need to change the entity type in the power app portal or mark the checkbox in classic Dynamics 365 interfaces.


  1. Standard Entity- They are created and managed inside Dynamics 365 database. Data is stored in the Dynamics 365 database and fields can be created, updated, and retrieved in Dynamics 365 itself


  1. Virtual Entity- Virtual entities can be used to create custom integrations with external systems or to enhance the functionality of Dynamics 365 by incorporating external data.

The unique feature of virtual entities is the ability to access and manipulate data from external sources like Sharepoint or MS SQL without replicating that data in the Dynamics 365 database. 

Virtual entities do not support all the features and functionalities that regular entities in Dynamics 365 support, such as workflows or business rules.


Standard Entity

Virtual Entity

Data is stored in the Dynamics 365 database

Data is not stored in the Dynamics 365 database; it is accessed through an external data source using OData endpoints

Data can be created, updated, and retrieved in Dynamics 365

Data is retrieved from the external data source when accessed in Dynamics 365

Schema is defined by the OData endpoint and includes the data source and schema

Schema is defined in Dynamics 365 and includes fields, relationships, and other properties of the entity

Supports all features and functionalities available in Dynamics 365, such as workflows, business rules, and plugins

Has some limitations in terms of the features and functionalities available

Used for storing and managing data within Dynamics 365

Used for integrating external data sources with Dynamics 365, or for enhancing the functionality of Dynamics 365 by incorporating external data


Prerequisite for virtual entities in Dynamics 365:-


  1. OData endpoint: A valid OData endpoint is required to connect to the external data source.

  2. Data source: The external data source should be accessible and provide the required data for the virtual entity.

  3. Data mapping: The external data should be mapped to the virtual entity schema in Dynamics 365. This involves defining the fields, relationships, and other properties of the virtual entity based on the external data source.

  4. Security: Appropriate security permissions should be configured to access the external data source

  5. Dynamics 365 version: Virtual entities are supported in Dynamics 365 version 9.0 and later versions.


Advantages

  1. Reduced data storage requirements: Virtual entities allow you to avoid replicating data in the Dynamics 365 database, which can help reduce storage requirements and simplify data management.


  1. Integration with external systems: virtual entities make it easier to integrate with external systems and incorporate external data within Dynamics 365.


  1. Improved performance: By avoiding the need to store large amounts of data in the Dynamics 365 database


  1. Real-time data access: Since virtual entities access data in real time, you can be sure that you are working with the most up-to-date data available.


Steps are different for creating the virtual table in the classic dynamics interface and in makepower app page. The steps for both are described below.


Steps for creating Virtual Table/entity in the makePowerApp portal


1. Log in to the CRM instance and go to tables, Click on Create on “New Table”


2. Click on Advance Options


3. Select Virtual from the Type field, 2 other fields will become mandatory now i.e. External name and External Plural name


4. Fill in the details for the External name and External Plural name fields. This name should match with the table which is created in an external data sources like SharePoint or MS SQL


5. Scroll down and choose your external data source. For this, the data source should be Added to use for virtual tables. The creation and addition of data sources are shared in another blog.

(1. Sign in to Power Apps, and then select Settings > Advanced settings. 2. Go to Settings > Administration > Virtual Entity Data Sources. 3. On the actions toolbar, select New. 4. On the Select Data Provider dialog box, select from the following data sources, and then select OK.)


6.  Click on the Save button


7. Go to the and click on a column to create a column


8. Click on create new Solumn button and fill the details. Click on Advance Options

9. Give the external name, it should match with the name in external data like SQL or Sharepoint. Click on save.

You’ve successfully created a virtual table. 



Steps for creating Virtual Table/entity in the makePowerApp portal

1. In solution explorer, create a new table. To do this, select Entities in the left navigation pane, and then select New.

2. On the General tab of the Entity Definition, select Virtual Entity, and then in the Data Source drop down list, select the data source that you want.
Virtual table option on table definition.

3. On the Entity Definition, complete the following required columns.

External Name- Enter the name of the table in the external data source this table maps to. 

External Collection Name -Enter the plural name of the table in the external data source this table maps to.

4. Here's an example of a virtual table named Movie that uses an Azure Cosmos DB data provider to access document files.
Virtual table definition using the Azure Cosmos DB data provider.



No comments:

Post a Comment

Followers

Power Dynamix YouTube Videos