Use Parameters in Reports

[Applies to: Microsoft Dynamics CRM 2011]

You use parameters in reports to control the data retrieved by a report by prompting the user for a value or a set of values when the user runs the report. The dataset query retrieves only the data that is requested by the user. You can also add hidden and special parameters in the reports that do not prompt the user for input, but can be used for operations such as data filtering and dynamic drill-through. For more information about how to use parameters in reports, see the MSDN topic Adding Parameters to Your Reports.


The maximum length of the parameter values that is passed in from Microsoft Dynamics CRM is 2,000 characters. For example, if you run a report and create a data filter through the Advanced Find user interface, the resulting filter expression that is passed to a filter parameter cannot exceed 2,000 characters. There is no maximum limit on the number of parameters that you can specify. However, you might have to limit the length of the string on the URL line and number of parameters to meet the requirements of a particular browser.

Adding Parameters

You can add parameters to a report to define a report’s individual parameters, pass information through a query, or provide access to user settings, such as CRM_CurrencySymbol and CRM_CurrencyPositivePattern parameters.

The <ReportParameter> is an element in the report definition (RDL) file that is used to describe an individual parameter in the report. The <QueryParameter> contains information about an individual parameter that is passed to the data source as part of a query. The following XML code taken from the Account Summary report's RDL file demonstrates how to use the ReportParameter and QueryParameter parameters.

<ReportParameter Name="FilteredAccount">
         <Value>select account0.* from FilteredAccount as "account0"</Value>
   <CommandText>declare @sql as nVarchar(max)
      set @sql = '
      SELECT top 10 CAST(accountid as nvarchar(100)) as AccountID,
      name, '''' as None
      FROM (' + @FilteredAccount + ') as fa'
      <QueryParameter Name="@FilteredAccount">

The following examples show how to use the QueryParameter and ReportParameter parameters in a Fetch based report:

<ReportParameter Name="FilteredAccount">
      <Prompt>Filtered Account</Prompt>
                              &lt;fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false"&gt;
                              &lt;entity name="account"&gt;
                  &lt;entity name="account" enableprefiltering="true" prefilterparametername="FilteredAccount" &gt;
                  &lt;attribute name="accountid" /&gt;
                  &lt;attribute name="name" /&gt;
          <QueryParameter Name="FilteredAccount">

Hidden Parameters

The Report Designer in Business Intelligence Development Studio has built-in support for hidden parameters. In addition, you can hide parameters by adding a CRM_ prefix to the parameter name in a Microsoft Dynamics CRM report. By default, the parameters with a CRM_ prefix are hidden when the report is published through Microsoft Dynamics CRM. When you run the report, you are not prompted to enter parameter values for the hidden parameters.

Special Parameters

The following table shows the special hidden parameters that you can use in your reports.

Parameter Description


Contains the value of the filter text that a report user interactively creates in the Report Viewer when the user runs a report. The parameter is in a filter summary text box that is located in the report header. The initial value is set to the default filter.


Set to the URL of the Microsoft Dynamics CRM Web application. Use this parameter when drilling through to Microsoft Dynamics CRM.


Use in a query expression to enable data pre-filtering (through Advanced Find).

You must create all parameters in a report before you can refer to them. The values of these special parameters are filled in by Microsoft Dynamics CRM when you run the report.

Additional Format Parameters

The following table contains additional parameters that you can use in the reports. Among them are parameters that provide access to the user Number settings information. You can use these values to format and display the numeric values. These parameters are similar to values specified in the NumberFormatInfo Class. Use these parameters in custom reports to format the data according to the user settings.

Parameter Description


The full name of the user on whose behalf the report is running.


User’s time zone name, for example, Pacific Standard Time.


Current locale (LCID) of the user.


The first week of the year that is used in Microsoft Dynamics CRM 2011.


The first day of the week that is used in Microsoft Dynamics CRM 2011.


The start date for the fiscal year that is used in Microsoft Dynamics CRM 2011.


Specifies how the fiscal year is divided, Quarterly, Monthly, Annually and so on.


Specifies whether the fiscal year name is displayed based on when the fiscal year starts or when it ends.


Specifies how the fiscal year and fiscal period are connected when displayed together.


Specifies how the name of the fiscal year will be displayed.


Specifies how the fiscal period will be displayed.


Specifies whether a prefix is attached to the fiscal year when it is displayed.


Specifies whether a suffix is attached to the fiscal year when it is displayed.


The currency decimal precision.


The organization’s currency symbol.


The format pattern for positive currency values.


The format pattern for negative currency values.


The number of decimal places to use in numeric values.


The string that is used as a decimal separator in numeric values.


The format pattern for negative numeric values.


The number of digits in each group to the left of the decimal in numeric values.


The string that separates groups of digits to the left of the decimal in numeric values.


The string that separates the components of a date, such as year, month, and day.


The string that separates the components of time, such as hour, minutes, and seconds.


The string that separates the components of time, such as hour, minutes, and seconds


The designator for hours that are "post meridiem" (PM).


The format pattern for a short date value that is associated with the "d" format pattern.


The format pattern for a long date value that is associated with the "D" format pattern.


The format pattern for a short time value that is associated with the "t" format pattern.


The format pattern for month and day values that are associated with the "m" and "M" format patterns.

See Also


Publish Reports
Add Report Navigation
Use Filters in a Report

Other Resources

Create Reports for Microsoft Dynamics CRM Using SQL Server Reporting Services

Microsoft Dynamics CRM 2011
Send comments about this topic to Microsoft.
© 2013 Microsoft Corporation. All rights reserved.