# The magical option to refresh virtual table relationships in Dataverse

My goal in this blog post will be to provide you with steps that will help you to auto-refresh Virtual table relationships when changes are made to the Data entity relationships in Dynamics 365 FO.

# Business scenario:

Consider the scenario where you have modified & developed several standard and custom data entities and defined the relationships required by the business.

As a result of the discussion with the business SME, it was discovered that Power Apps or Dynamics 365 CE require a few additional relationships between the data fields.

# Let’s deep dive and understand the steps

I have chosen \*\*PurchPurchaseOrderHeaderV2Entity (\*\*Public Collection Name: PurchaseOrderHeadersV2) as an example.

**Assumption:** **PurchPurchaseOrderHeaderV2Entity** is already enabled as a Virtual table in the Dataverse.

In some situations, it is not necessary to enable all data entities as virtual tables within the main entity relationship.

As part of my scenario, I have enabled two existing relationships between data entities.

Do you know? A relationship on a data entity is primarily used to automate lookups in Power Apps or Dynamics 365 CE. Isn’t a cool low code option. 😎

Refer to my YouTube videos if you would like to learn more about virtual entities and Dynamics 365 Cross apps.

[Cross Apps Learning](https://www.youtube.com/playlist?list=PLYmwjudBLRo4GcJLnSsgVBnlp-kLzgWkU)

The standard data entity of **PurchPurchaseOrderHeaderV2Entity** has two relationships (DimensionDimensionSet & Project), and the view Dataverse shows the same relationship, as indicated in the snapshot below.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1670988104473/rjXTq2FY0.png align="left")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1670988163845/cwNVaXiV5.png align="left")

Based on the business scenario, I will add new relationships on Vendor Account Number and perform the steps to enable the same in Dataverse with a single button click.

1\. Navigate to Visual Studio and head over to Solution and create an extension of OOB **PurchPurchaseOrderHeaderV2Entity**

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1670988216064/DrH8Ktp0N.png align="center")

2\. Build the VS solution

3\. Navigate to System Administration module -&gt; select Data management workspace -&gt; Framework parameters -&gt; Entity settings tab -&gt; Refresh entity list

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1670988255595/v0UHnUPqx.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1670988266140/qbsx8B8tb.png align="center")

4\. Depending on your Tier-1 box configuration, step 3 may take longer to complete, please wait until it does

5\. Navigate to the Advanced setting option in the maker portal of Power Apps ([https://make.powerapps.com/](https://make.powerapps.com/))

6\. Select the Advanced settings and lookup for the **PurchPurchaseOrderHeaderV2Entity** virtual table using advanced filter option

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1670988336068/J8eByIBXN.png align="center")

7\. Select the magical "Refresh" option to restore Data entity relationships of **PurchPurchaseOrderHeaderV2Entity**  in the Virtual table of Dataverse

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1670988378246/W3cqcWOOE.png align="center")

8\. Click on Save or Save & Close option

9\. Navigate to the Power Apps maker portal and select your Dataverse environment

10\. From the Left pane, select Dataverse and then Tables

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1670988420296/Riz6WTRYg.png align="center")

11\. To filter the virtual entities, choose **"mserp"** as the prefix and select **“All”** to show all virtual and physical tables

12\. The selected Virtual tables were automatically created as part of the virtual table's **"Visible"** option. Please refer to the assumption section.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1670988469121/G2L5SX19U.png align="center")

13\. Navigate to the relationships schema to validate the newly created Data entity relationships

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1670988494956/BT6CXuK90.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1670988503886/q_hgGgv21.png align="center")

# Conclusion

Developers and code reviewers can benefit greatly from even the simplest observations.

I hope this article was a good read for you. Do share it with your friends and other peers.

Thank you so much!

# Thank you for Reading - Let's Connect!

Enjoy my blog? For more such awesome blog articles - follow, subscribe and let's connect on [LinkedIn](https://www.linkedin.com/in/rakeshdarge/), [Twitter](https://twitter.com/DargeRakesh?s=08), [YouTube](https://www.youtube.com/user/rakeshdarge/videos)

Stay tuned!
