Skip to main content

XrmToolBox: AutoNumberUpdater - new StateCode filter

How to add your personal PowerBI Dashboard as a system dashboard

New Approach:

Attention: Microsoft added this feature out of the box, so that the manual approach below is not required anymore. More to this can be found here:

https://powerapps.microsoft.com/en-us/blog/power-bi-embedded-as-system-dashboard-in-model-driven-apps-preview/

Old Approach:

The general guideline on how to create a personal dashboard is described in this article:
https://docs.microsoft.com/en-us/powerapps/user/add-powerbi-dashboards

But what if you want to rollout a global PowerBI dashboard for all users?
With some tweaks you can manage it to make it work…
1. After you have created your personal dashboard you need to extract the formxml of that dashboard with this URL query in a browser tab:
https://org.crm4.dynamics.com/api/data/v9.1/userforms?$select=name,formxml&$filter=type eq 103 and name eq 'Ticket Status'
Replace…
type = 103 => PowerBi Dashboard
name = 'Your PowerBI Dashboard Name'
In the result copy the XML part out of the "formxml" property and replace the \" characters with double quotes ":

"formxml":"<form><tabs><tab showlabel=\"false\" verticallayout=\"true\" id=\"{79c2fe56-9774-4fcc-82d9-15be85cb49b6}\">
<labels><label description=\"Tab\" languagecode=\"1033\" /></labels><columns><column width=\"100%\">
<sections><section showlabel=\"false\" showbar=\"false\" columns=\"111\" id=\"{17a1f9a6-0a04-4662-8d47-05cecb80b3a7}\">
<labels><label description=\"Section\" languagecode=\"1033\" /></labels><rows><row><cell colspan=\"3\" rowspan=\"24\" 
showlabel=\"false\" id=\"{a294c3cf-aab6-482d-99e9-ed67cb0db353}\" availableforphone=\"false\"><labels />
<control id=\"Component04cd521\" classid=\"{8C54228C-1B25-4909-A12A-F2B968BB0D62}\"><parameters>
<PowerBIGroupId>12369285-0b8a-4760-89fa-bfb62f0bf123</PowerBIGroupId>
<PowerBIDashboardId>123bb8a5-5d15-4c62-a936-44fc7e202123</PowerBIDashboardId>
<TileUrl>https://app.powerbi.com/dashboardEmbed?dashboardId=123bb8a5-5d15-4c62-a936-44fc7e202123&amp;config=123jbHVzdGVyVXJs...%3d</TileUrl>
<Type>1</Type></parameters></control></cell></row></rows></section></sections></column></columns></tab></tabs></form>
2. Create a new solution:

3. Add a new dashboard to your solution
4. Export your solution
5. Unzip Solution file
6. Open the customization.xml file in your favorite editor tool
7. Search for the <Dashbard> Tag
8. Search for your localized dashboard name
9. Move forward to the <FormXml><forms type="dashboard"> tags
10. Replace the content and tags starting from <form> until you reach </form> tag.
11. Copy the formxml from the retrieved web api userform request of the first step above and put in between the <forms type="..."> ... </forms> tags.
12. Now change the form tab label id and the section label id by e.g. replacing the last number with a new number:
Form label id:

Section label id:

13. Save the customization.xml file and ZIP again the solution file
14. Import and publish your customized solution.
15. Check if it works

Sample

<Dashboards>
  <Dashboard>
    <LocalizedNames>
      <LocalizedName description="Technician Timesheet" languagecode="1033" />
    </LocalizedNames>
    <FormId>{e804f424-7488-ea11-a811-000d3aa96894}</FormId>
    <IsCustomizable>1</IsCustomizable>
    <IsDefault>0</IsDefault>
    <FormXml>
      <forms type="dashboard">
        <form>
          <tabs>
            <tab showlabel="false" verticallayout="true" id="{79c2fe56-9774-4fcc-82d9-15be85cb49b6}">
              <labels>
                <label description="Tab" languagecode="1033" />
              </labels>
              <columns>
                <column width="100%">
                  <sections>
                    <section showlabel="false" showbar="false" columns="111" id="{17a1f9a6-0a04-4662-8d47-05cecb80b3a7}">
                      <labels>
                        <label description="Section" languagecode="1033" />
                      </labels>
                      <rows>
                        <row>
                          <cell colspan="3" rowspan="24" showlabel="false" id="{a294c3cf-aab6-482d-99e9-ed67cb0db353}" availableforphone="false">
                            <labels />
                            <control id="Component04cd521" classid="{8C54228C-1B25-4909-A12A-F2B968BB0D62}">
                              <parameters>
                                <PowerBIGroupId>12369285-0b8a-4760-89fa-bfb62f0bf123</PowerBIGroupId>
                                <PowerBIDashboardId>123bb8a5-5d15-4c62-a936-44fc7e2028f4</PowerBIDashboardId>
                                <TileUrl>https://app.powerbi.com/dashboardEmbed?dashboardId=125bb8a5-5d15-4c62-a936-44fc…&amp;config=eyJjbHVzdGVyVXJsIjoiaHR0…0%3d</TileUrl>
                                <Type>1</Type>
                              </parameters>
                            </control>
                          </cell>
                        </row>
                      </rows>
                    </section>
                  </sections>
                </column>
              </columns>
            </tab>
          </tabs>
        </form>
      </forms>
    </FormXml>
    <IntroducedVersion>5.0.0.16</IntroducedVersion>
    <IsTabletEnabled>0</IsTabletEnabled>
  </Dashboard>
</Dashboards>
Now your report appears in the system dashboard section!

Further advantage is that you can configure the security roles valid for this report

Comments

Popular posts from this blog

Yet Another Address Autocomplete PCF Control–powered by Bing

In this blog post I will not go into detail in how to install all the pre-requisites that are required to build and run PCF controls. My goal was to build a new PCF control and get into coding of PCF controls as fast as possible. Here are a few links to articles that will help you installing the pre-requisites (Microsoft PowerApps CLI)  https://docs.microsoft.com/en-us/powerapps/developer/component-framework/get-powerapps-cli Other good references to get into this topic: https://toddbaginski.com/blog/how-to-create-a-powerapps-pcf-control/ https://docs.microsoft.com/en-us/powerapps/developer/component-framework/create-custom-controls-using-pcf I looked through the Guido Preite’s https://pcf.gallery/ which will help you find appropriate use cases / examples for your own needs. It did not take very long to find a simple example to start with: Andrew Butenko's https://pcf.gallery/address-autocomplete/ A few moments later I had the idea to create yet another address autocomplete...

Regarding SPFieldMultiLineText (Add HTML/URL content to a field) programmatically

I recently tried so set some HTML content in a SharePoint list column of type SPFieldMultiLineText. My first approach was this piece of code: SPFieldMultiLineText field = item.Fields.GetFieldByInternalName( "Associated Documents" ) as SPFieldMultiLineText; StringBuilder docList = new StringBuilder(); docList.Append( " " ); foreach (DataRow docRow in addDocs) { DataRow[] parent = dr.Table.DataSet.Tables[0].Select( "DOK_ID=" + docRow[ "DOK_MGD_ID" ].ToString()); if (parent != null && parent.Length > 0) { docList.AppendFormat( " {1} " , parent[0][ "FilePath" ].ToString(), parent[0][ "Title" ].ToString()); } } if (docList.Length > 0) { // remove trailing tag docList.Remove(docList.Length-5, 5); } docList.Append( " " ); string newValue = docList.ToString(); item[field.Title] = newValue; What this code does is to get all associated documents to the main document and to add these docu...

XrmToolBox: AutoNumberUpdater - new StateCode filter

Mayank Pujara's AutoNumberUpdater plugin for the XrmToolBox is a great tool to add missing auto number values to an auto number field for an entity/table. In his blog you can find more details about the original version of his plugin: https://mayankp.wordpress.com/2021/12/09/xrmtoolbox-autonumberupdater-new-tool/ For my purposes I had to update accounts with missing account numbers, but in my use case this should only be done for those accounts that have the status value "Active".   As this plugin did not have this feature I quickly implemented it and Mayank merged my changes to his plugin source code. You can download the new version 1.2024.0.1 in the Tool Library of the XrmToolBox.