Споделяне чрез


Create a dashboard

 

Applies To: Dynamics CRM 2015

Organization-owned dashboards can be created by using the Microsoft Dynamics CRM SDK or by customizing the entity form in Microsoft Dynamics CRM by editing the customizations.xml file.

Note

Some dashboards that are created by using the SDK or by customizing the entity form are not supported by the Dashboard Designer in the Web application. For more information, see Limitations: Creating dashboards by using the SDK or through form customization later in this topic.

Before creating a dashboard, consider the following:

  • Type of dashboard: If you want your dashboards to be available across the organization and do not want to manage the access levels at a more granular level, you might want to create an organization-owned dashboard. However, if you are concerned about the access privileges and security of your dashboard, consider creating a user-owned dashboard where you have more control on who can access it.

    To create organization-owned dashboards, you must have the System Administrator or System Customizer role.

  • Dashboard layout: While creating dashboards, you have to use the FormXML to define the dashboard components and layout. For information about working with FormXML to define a dashboard, see 4676c26b-8f5b-4497-b552-056e74ab2a07#DashboardComponentsandFormXML. For some sample FormXMLs of different types of dashboards, see Sample dashboards.

In This Topic

Create a dashboard by using the SDK

Create an organization-owned dashboard by customizing the entity form

Limitations: Creating dashboards by using the SDK or through form customization

Create a dashboard by using the SDK

To create a dashboard, create an instance of SystemForm for an organization-owned dashboard, or UserForm for a user-owned dashboard. The following sample shows how to create an organization-owned dashboard.


//This is the language code for U.S. English. If you are running this code
//in a different locale, you will need to modify this value.
int languageCode = 1033;

//We set up our dashboard and specify the FormXml. Refer to the
//FormXml schema in the Microsoft Dynamics CRM SDK for more information.
SystemForm dashboard = new SystemForm
{
    Name = "Sample Dashboard",
    Description = "Sample organization-owned dashboard.",
    FormXml = String.Format(@"<form>
            <tabs>
                <tab name='Test Dashboard' verticallayout='true'>
                    <labels>
                        <label description='Sample Dashboard' languagecode='{0}' />
                    </labels>
                    <columns>
                        <column width='100%'>
                            <sections>
                                <section name='Information Section'
                                    showlabel='false' showbar='false'
                                    columns='111'>
                                    <labels>
                                        <label description='Information Section'
                                            languagecode='{0}' />
                                    </labels>
                                    <rows>
                                        <row>
                                            <cell colspan='1' rowspan='10' 
                                                showlabel='false'>
                                                <labels>
                                                    <label description='Top Opportunitiess - 1'
                                                    languagecode='{0}' />
                                                </labels>
                                                <control id='TopOpportunities'
                                                    classid='{{E7A81278-8635-4d9e-8D4D-59480B391C5B}}'>
                                                    <parameters>
                                                        <ViewId>{1}</ViewId>
                                                        <IsUserView>false</IsUserView>
                                                        <RelationshipName />
                                                        <TargetEntityType>opportunity</TargetEntityType>
                                                        <AutoExpand>Fixed</AutoExpand>
                                                        <EnableQuickFind>false</EnableQuickFind>
                                                        <EnableViewPicker>false</EnableViewPicker>
                                                        <EnableJumpBar>false</EnableJumpBar>
                                                        <ChartGridMode>Chart</ChartGridMode>
                                                        <VisualizationId>{2}</VisualizationId>
                                                        <EnableChartPicker>false</EnableChartPicker>
                                                        <RecordsPerPage>10</RecordsPerPage>
                                                    </parameters>
                                                </control>
                                            </cell>
                                            <cell colspan='1' rowspan='10' 
                                                showlabel='false'>
                                                <labels>
                                                    <label description='Top Opportunities - 2'
                                                    languagecode='{0}' />
                                                </labels>
                                                <control id='TopOpportunities2'
                                                    classid='{{E7A81278-8635-4d9e-8D4D-59480B391C5B}}'>
                                                    <parameters>
                                                        <ViewId>{1}</ViewId>
                                                        <IsUserView>false</IsUserView>
                                                        <RelationshipName />
                                                        <TargetEntityType>opportunity</TargetEntityType>
                                                        <AutoExpand>Fixed</AutoExpand>
                                                        <EnableQuickFind>false</EnableQuickFind>
                                                        <EnableViewPicker>false</EnableViewPicker>
                                                        <EnableJumpBar>false</EnableJumpBar>
                                                        <ChartGridMode>Grid</ChartGridMode>
                                                        <VisualizationId>{2}</VisualizationId>
                                                        <EnableChartPicker>false</EnableChartPicker>
                                                        <RecordsPerPage>10</RecordsPerPage>
                                                    </parameters>
                                                </control>
                                            </cell>
                                        </row>
                                        <row />
                                        <row />
                                        <row />
                                        <row />
                                        <row />
                                        <row />
                                        <row />
                                        <row />
                                        <row />
                                    </rows>
                                </section>
                            </sections>
                        </column>
                    </columns>
                </tab>
            </tabs>
        </form>",
    languageCode,
    defaultOpportunityQuery.SavedQueryId.Value.ToString("B"),
    visualization.SavedQueryVisualizationId.Value.ToString("B")),
    IsDefault = false
};
_dashboardId = _serviceProxy.Create(dashboard);

'This is the language code for U.S. English. If you are running this code
'in a different locale, you will need to modify this value.
Dim languageCode As Integer = 1033

'We set up our dashboard and specify the FormXml. Refer to the
'FormXml schema in the Microsoft Dynamics CRM SDK for more information.
Dim dashboard As SystemForm =
 New SystemForm With {
  .Name = "Sample Dashboard",
  .Description = "Sample organization-owned dashboard.",
  .FormXml = String.Format("<form><tabs><tab name='Test Dashboard' verticallayout='true'>" &amp; _
                           "<labels><label description='Sample Dashboard' languagecode='{0}' />" &amp; _
                           "</labels><columns><column width='100%'><sections>" &amp; _
                           "<section name='Information Section' showlabel='false' showbar='false' columns='111'>" &amp; _
                           "<labels><label description='Information Section' languagecode='{0}' />" &amp; _
                           "</labels><rows><row><cell colspan='1' rowspan='10' showlabel='false'><labels>" &amp; _
                           "<label description='Top Opportunitiess - 1' languagecode='{0}' /></labels>" &amp; _
                           "<control id='TopOpportunities' classid='{{E7A81278-8635-4d9e-8D4D-59480B391C5B}}'>" &amp; _
                           "<parameters><ViewId>{1}</ViewId><IsUserView>false</IsUserView><RelationshipName />" &amp; _
                           "<TargetEntityType>opportunity</TargetEntityType><AutoExpand>Fixed</AutoExpand>" &amp; _
                           "<EnableQuickFind>false</EnableQuickFind><EnableViewPicker>false</EnableViewPicker>" &amp; _
                           "<EnableJumpBar>false</EnableJumpBar><ChartGridMode>Chart</ChartGridMode>" &amp; _
                           "<VisualizationId>{2}</VisualizationId><EnableChartPicker>false</EnableChartPicker>" &amp; _
                           "<RecordsPerPage>10</RecordsPerPage></parameters></control></cell>" &amp; _
                           "<cell colspan='1' rowspan='10' showlabel='false'><labels>" &amp; _
                           "<label description='Top Opportunities - 2' languagecode='{0}' /></labels>" &amp; _
                           "<control id='TopOpportunities2' classid='{{E7A81278-8635-4d9e-8D4D-59480B391C5B}}'>" &amp; _
                           "<parameters><ViewId>{1}</ViewId><IsUserView>false</IsUserView><RelationshipName />" &amp; _
                           "<TargetEntityType>opportunity</TargetEntityType><AutoExpand>Fixed</AutoExpand>" &amp; _
                           "<EnableQuickFind>false</EnableQuickFind><EnableViewPicker>false</EnableViewPicker>" &amp; _
                           "<EnableJumpBar>false</EnableJumpBar><ChartGridMode>Grid</ChartGridMode>" &amp; _
                           "<VisualizationId>{2}</VisualizationId><EnableChartPicker>false</EnableChartPicker>" &amp; _
                           "<RecordsPerPage>10</RecordsPerPage></parameters></control></cell></row><row /><row />" &amp; _
                           "<row /><row /><row /><row /><row /><row /><row /></rows></section></sections></column>" &amp; _
                           "</columns></tab></tabs></form>",
                           languageCode,
                           defaultOpportunityQuery.SavedQueryId.Value.ToString("B"),
                           visualization.SavedQueryVisualizationId.Value.ToString("B")),
  .IsDefault = False
 }
_dashboardId = _serviceProxy.Create(dashboard)

For a complete sample, see Sample: Create, retrieve, update, and delete a dashboard. For a sample to create a user-owned dashboard, and assign it to another user, see Sample: Assign a user-owned dashboard to another user.

Create an organization-owned dashboard by customizing the entity form

The customizations.xml file that is exported with an unmanaged solution contains definitions for entity forms and dashboards. You can add or modify the customizations.xml file to add or update a dashboard.

Create a dashboard by customizing an entity form

  1. Log on to Microsoft Dynamics CRM.

  2. Export a solution. For information about doing so, see Export, prepare to edit, and import the ribbon.

  3. Browse to the customizations.xml file in the exported solution folder, and open it for editing.

  4. Browse to the end of the dashboards area in the customizations.xml file by searching for the following tag: </Dashboards>

  5. Before the </Dashboards> tag, add the following to define a new dashboard:

    <Dashboard>   <LocalizedNames>      <LocalizedName description="<Dashboard_Name>" languagecode="1033" />   </LocalizedNames>      <IsCustomizable>1</IsCustomizable>   <IsDefault>0</IsDefault>   <FormXml>      <forms type="dashboard">         *** Dashboard definition goes here. *** </forms>   </FormXml></Dashboard>
    
  6. Save the customizations.xml file.

  7. Import the .zip file as a solution in Microsoft Dynamics CRM. More information: Export, prepare to edit, and import the ribbon.

Limitations: Creating dashboards by using the SDK or through form customization

Certain dashboards that are created or modified using the Microsoft Dynamics CRM SDK or through form customization are not supported by the dashboard designer in the Web application. Avoid the following while creating or modifying a dashboard using the SDK or through form customization.

General

  • Problem: You can create a dashboard that contains a tab without any section defined in the FormXML.

    Resolution: Make sure that you create a dashboard with at least one section defined for each tab in the FormXML.

  • Problem: You can create a dashboard that does not have the same number of <row> (FormXml) elements for a section as specified in the rowspan property of a <cell> (FormXml) element of the section in the FormXML. Ideally, the rowspan property value of a <cell> (FormXml) element and the number of <row> (FormXml) elements in a section must be same.

    Resolution: Make sure that you create a dashboard that has the same number of <row> (FormXml) elements for a section as specified in the rowspan property of a <cell> (FormXml) element in the section.

Grids

Problem: You can create a dashboard that contains grids with the <AutoExpand> (FormXml) parameter value set to Auto for the grid.

Resolution: Make sure that you specify the <AutoExpand> (FormXml) parameter value as Fixed for the grids in the FormXML while creating a dashboard.

IFRAMEs

Problem: You can create a dashboard that contains an IFRAME. This happens when you do not specify any value for the <Url> (FormXml) parameter for the IFRAME control in the FormXML.

Resolution: Make sure that you specify a value for the <Url> (FormXml) parameter while creating an IFRAME in the FormXML.

See Also

Analyze data with dashboards
Understand dashboards: Dashboard components and FormXML
Actions on dashboards
Sample dashboards
Sample: Create, retrieve, update, and delete a dashboard
Customize entity forms

© 2016 Microsoft. All rights reserved. Copyright