Migrating Personal Dashboards and Charts using Impersonation in Dynamics 365

Personal Charts and Dashboards can be created in Dynamics 365 systems which allow Users to view their data in a format they create. These charts and dashboards are different from system defined versions in that they are only available to the creator/owner and users they decide to share them with. Unlike system charts and dashboards, personal ones cannot be added to a solution, so migrating them from one system to another can be difficult. In this blog I will give an example of migrating my own personal charts and dashboards from one system to another by using a console application.

image thumb Migrating Personal Dashboards and Charts using Impersonation in Dynamics 365

The screenshot above shows the code in the console application which I used for the migration. After retrieving the Guid for my own User in the first retrieve, I could use this to retrieve my personal charts and dashboards by setting the CallerId of the OrganizationProxyService to the retrieved Guid. The logical names for these two entities are “userqueryvisualization” (charts) and “userform” (dashboards).

It is important to note that this example uses impersonation. Although I did not need to use impersonation to retrieve my personal data from Dynamics 365, it gives an idea of how you would migrate personal data of other Users if you needed to. Once I have these records retrieved, I can retrieve the Guid of my own User in the second environment and use this to set the CallerId again. For this example, I connected to two different instances outside of the method shown and created global variables for the OrganizationProxyService named sdkOne and sdkTwo. After this, all that’s needed to be done is to iterate through the list of charts and dashboards and create them in the new environment.

image thumb 1 Migrating Personal Dashboards and Charts using Impersonation in Dynamics 365

The screenshots above and below show a personal chart that was migrated from the first instance to the second instance via the console application developed.

image thumb 2 Migrating Personal Dashboards and Charts using Impersonation in Dynamics 365

Let’s block ads! (Why?)

Magnetism Solutions Dynamics CRM Blog