创建仪表板

 

发布日期: 2017年1月

适用于: Dynamics 365 (online),Dynamics 365 (on-premises),Dynamics CRM 2016,Dynamics CRM Online

可以通过以下方法创建组织负责的仪表板:使用 Microsoft Dynamics 365 SDK,或者通过编辑 customizations.xml 文件自定义 Microsoft Dynamics 365 中的实体窗体。

备注

Web 应用程序中的仪表板设计器不支持使用 SDK 或通过自定义实体窗体创建的一些仪表板。 有关详细信息,请参阅本主题中后面的限制:使用 SDK 或通过窗体自定义创建仪表板。

创建仪表板之前,请考虑以下项:

  • 仪表板类型:如果希望仪表板可以在整个组织中使用,并且不希望在更详细的级别管理访问级别,则可能需要创建组织负责的仪表板。 但是,如果您担心仪表板的访问权限和安全性,请考虑创建用户负责的仪表板,其中您对可以访问仪表板的人员拥有更多控制。

    若要创建组织负责的仪表板,您必须具有系统管理员或系统定制员角色。

  • 仪表板布局:创建仪表板时,必须使用 FormXML 定义仪表板组件和布局。 有关使用 FormXML 定义仪表板的信息,请参阅仪表板组件和 FormXML 元素。 有关不同类型仪表板的一些示例 FormXML,请参阅示例仪表板

本主题内容

使用 SDK 创建仪表板

通过自定义实体窗体创建组织负责的仪表板

限制:使用 SDK 或通过窗体自定义创建仪表板

使用 SDK 创建仪表板

若要创建仪表板,请创建用户负责的仪表板的 SystemForm 的实例,或者创建组织负责的仪表板的 UserForm 的实例。 以下示例演示如何创建组织负责的仪表板。


//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)

有关完整示例,请参阅示例;创建、检索、更新和删除仪表板。 有关创建用户负责的仪表板并将其分派给其他用户的示例,请参阅示例:将用户负责的仪表板分派给另一个用户

通过自定义实体窗体创建组织负责的仪表板

随非托管解决方案一起导出的 customizations.xml 文件包含实体窗体和仪表板的定义。 您可以通过添加或修改 customizations.xml 文件来添加或更新仪表板。

通过自定义实体窗体创建仪表板

  1. 登录到 Microsoft Dynamics 365。

  2. 导出解决方案。 有关执行此操作的信息,请参阅导出功能区、准备编辑和导入功能区

  3. 浏览到导出的解决方案文件夹中的 customizations.xml 文件,然后将其打开以便编辑。

  4. 通过搜索以下标记浏览到 customizations.xml 文件中仪表板区域的末尾:</Dashboards>

  5. 在 </Dashboards> 标记前面,添加以下项来定义新仪表板:

    <Dashboard>
        <LocalizedNames>
            <LocalizedName description="Dashboard_Name" languagecode="1033" />
        </LocalizedNames>   
        <IsCustomizable>1</IsCustomizable>
        <IsDefault>0</IsDefault>
        <FormXml>
            <forms type="dashboard">
                *** Dashboard definition goes here. *** // See “Sample Dashboards” topic for the FormXML content to be used here.
            </forms>
        </FormXml>
    </Dashboard>
    
  6. 保存 customizations.xml 文件。

  7. 导入该 .zip 文件,作为 Microsoft Dynamics 365 中的解决方案。详细信息:导出功能区、准备编辑和导入功能区

限制:使用 SDK 或通过窗体自定义创建仪表板

Web 应用程序中的仪表板设计器不支持使用 Microsoft Dynamics 365 SDK 或通过窗体自定义创建或修改的某些仪表板。 使用 SDK 或通过窗体自定义创建或修改仪表板时避免以下项。

常规

  • 问题:您可以创建包含选项卡的仪表板,但没有在 FormXML 中定义任何区域。

    解决方案:确保创建仪表板时至少在 FormXML 中为每个选项卡定义一个区域。

  • 问题:您可以创建一个仪表板,其具有的区域的 <row> (FormXml) 元素数与 FormXML 中该区域的 <cell> (FormXml) 元素的 rowspan 属性所指定的数量不相同。 理想情况下,<cell> (FormXml) 元素的 rowspan 属性值与区域中的 <row> (FormXml) 元素数必须相同。

    解决方案:确保创建一个仪表板,其具有的区域的 <row> (FormXml) 元素数与该区域的 <cell> (FormXml) 元素的 rowspan 属性中指定的数量相同。

网格

问题:您可以创建包含网格的仪表板,该网格的 <AutoExpand> (FormXml) 参数值设置为 Auto

解决方案:创建仪表板时,确保在 FormXML 中为网格将 <AutoExpand> (FormXml) 参数值指定为 Fixed

IFRAME

问题:您可以创建包含 IFRAME 的仪表板。 您不在 FormXML 中为 IFRAME 控件的 <Url> (FormXml) 参数指定任何值时,会发生这种情况。

解决方案:在 FormXML 中创建 IFRAME 时,确保为 <Url> (FormXml) 参数指定值。

另请参阅

使用仪表板分析数据
了解仪表板:仪表板组件和 FormXML
仪表板上的操作
示例仪表板
示例;创建、检索、更新和删除仪表板
自定义实体窗体

Microsoft Dynamics 365

© 2017 Microsoft。 保留所有权利。 版权