SSRS Reporting
SQL Server Reporting Services (SSRS) reports are the primary mechanism for generating paginated, printable business documents in Dynamics 365 Finance & Operations. Every invoice, packing slip, purchase order confirmation, financial statement, and regulatory report in the standard application is an SSRS report defined in the AOT.
An AOT Report object (AxReport) is a self-contained metadata definition that brings together:
- Data Sets — define where report data comes from (queries, RDP classes, or business logic).
- Parameters — define the inputs the user provides before running the report (date ranges, account filters, sorting options).
- Designs — define how the data is laid out on the rendered page (tables, lists, matrices, charts).
- Data Methods — X++ methods callable from report expressions for custom formatting or calculations.
- Embedded Images — images bundled with the report for logos, watermarks, etc.
Report Execution Flow
When a user runs an SSRS report (typically by clicking an Output menu item), the following sequence occurs:
- The Output menu item creates an
Argsobject and invokes the report controller class (typicallySrsReportRunControlleror a subclass). - The controller reads the report's parameters and displays a dialog to the user, pre-populated with default values.
- The user fills in parameters (date range, account filters, etc.) and clicks OK.
- The controller passes the parameter values to the data set, which executes the underlying query or RDP class to retrieve data.
- The SSRS rendering engine applies the design (Auto Design or Precision Design) to format the data.
- The rendered report is returned to the user as a screen preview, PDF, Excel, Word, or direct print.
The SrsReportRunController class handles the entire report lifecycle — dialog presentation, parameter validation, data retrieval, rendering, and output delivery. Custom controllers typically override preRunModifyContract() to set default parameter values based on the calling context.
Data Source Types
Every report data set has a DataSourceType property that determines how data is retrieved:
| Data Source Type | Value | Description |
|---|---|---|
| Query | 1 | Binds to an AOT Query object. The simplest option — the report framework executes the query and populates the data set fields automatically. |
| Report Data Provider (RDP) | 3 | Binds to an X++ class that extends SrsReportDataProviderBase. The RDP class executes custom business logic and populates a temporary table (TmpTable), which the report reads as its data set. This is the most common approach for complex reports. |
| Business Logic | 2 | An older pattern where the data set is populated by X++ business logic methods defined on the report. Rarely used in modern development. |
| Enum Provider | 4 | A specialised data source that provides enum values as data. Used for parameter lookups. |
Report Data Provider (RDP) Pattern
The RDP pattern is the standard approach for most D365 F&O reports. It involves three key objects:
- Data Contract — a class decorated with
[DataContractAttribute]that defines the report parameters (date ranges, filters, options). - RDP Class — a class extending
SrsReportDataProviderBasedecorated with[SRSReportParameterAttribute(classStr(MyDataContract))]that executes the business logic and fills a temporary table. - Temporary Table — an
InMemoryorTempDbtable that holds the processed report data.
Query-based Data Sets
For simpler reports, the data set can reference an AOT Query directly. The Query property on the data set specifies the query name, and the framework executes it automatically. Fields from the query's data sources appear as data set fields.
Parameters
Report parameters define the inputs presented to the user in the report dialog. Parameters can be:
- Visible — shown in the dialog for user input.
- Hidden — present in the data flow but not shown in the dialog (set programmatically).
- Internal — used only within the report logic, invisible to both the dialog and the data contract.
Parameters support default values, multi-value selection, nullable values, and prompt strings (labels shown in the dialog).
When using the RDP pattern, parameters are typically defined on the Data Contract class rather than directly on the report, because the SrsReportRunController infrastructure reads the contract attributes to build the dialog automatically.
Invoking Reports from Code
Integrating with Output Menu Items
Reports are typically launched through Output menu items (see Menu Items). The menu item's Object property points to the report controller class, and the ObjectType is set to Class. The controller's main() method receives the Args object, which may contain a caller record for context-sensitive report generation.
Properties
Report Properties
| Property | Display Name | Type | Description |
|---|---|---|---|
| ReportAxReport | |||
| Name | Name | String | The name of the element. |
| IsObsolete | Is Obsolete | NoYes | Determines whether the element is deprecated or not. Values: No (0), Yes (1). |
| Visibility | Visibility | CompilerVisibility | The visibility of the report object. Values: Private (0), Protected (1), Public (2), Internal (3), InternalProtected (4). |
| Tags | Tags | String | Tags for this element separated by semicolon. |
| Title | Title | String | Specifies the title of the report. |
| TitleOverridden | Title Overridden | Boolean | Indicates whether the title is overridden or not. (read-only) |