Add your custom report

The Sitefinity CMS Diagnostics module provides developers with the option to display diagnostics information using custom reports. Apart from using Sitefinity's built-in custom reports, you can create your own report reflecting your diagnostics requirements.

Custom reports are basically stored procedures from the diagnostics database. Such stored procedures have names that start with the prefix sf_diag_report_.  In addition, these stored procedures are displayed in the diagnostics user interface (UI), so that you can execute them. Note that the prefix is not displayed in the user interface. For example, Sitefinity's two built-in custom reports' names – RunBigResultSetAnalysis and  RunLongQueryAnalysis - are stored in the database as sf_diag_report_RunBigResultSetAnalysis and sf_diag_report_RunLongQueryAnalysis respectively.

To create your custom report, you need to add a new stored procedure in the diagnostics database. When creating your stored procedure, you put parameters that define the conditions for generating the required diagnostics reports. These parameters are extracted and a dynamic UI is constructed by the system.You can use two types of controls, that is, UI elements - a TextBox and a DateTimePicker. The text box serves as input field for all basic data types – int, string, bool, GUID, and so on.

Each report can return different results. The grid is automatically populated with those results.

Create a new stored procedure

  1. Open the tool you are using for accessing your database.
  2. Add your new stored procedure.
    Following is an example of a stored procedure that selects all columns from the OperationLog table and returns only the ones that correspond to the desired category:

As a result, your new report is added in the diagnostics UI as an additional custom report and you can run it.

Want to learn more?

Sign up for our free beginner training. Boost your credentials through advanced courses and certification.
Register for Sitefinity training and certification.

Was this article helpful?