[D365] How to get SSRS Report design from form letter print management

There is a way to get the default report layout by code using the following line:


Finding the report design from the print management settings for a report type is easy on the surface.
As example, navigate to Accounts receivable > Setup > Forms > Form setup, select the report type and create/see the various settings.

Retrieving the default report design name from there by code can be done with the following method:

/// Returns the selected report design for a given company and document type.
/// The DataAreaId to search in.
/// The PrintMgmtDocumentType to get the design for.
public static SRSCatalogItemName ccGetSelectedDesignByTypeAndCompany(DataAreaId _company, PrintMgmtDocumentType _documentType)
    DataAreaId searchCompany = _company ? _company : curExt();
	// Records are company specific, we need to change company first.
        PrintMgmtSettings printMgmtSettings;
        PrintMgmtDocInstance printMgmtDocInstance;
        PrintMgmtReportFormat printMgmtReportFormat;

        select firstonly * from printMgmtSettings
            join * from printMgmtDocInstance
            where printMgmtDocInstance.DocumentType == _documentType
                && printMgmtDocInstance.RecId == printMgmtSettings.ParentId
            join * from printMgmtReportFormat
            where printMgmtReportFormat.RecId == printMgmtSettings.ReportFormat;
        if (printMgmtReportFormat && printMgmtReportFormat.RecId)
            return printMgmtReportFormat.Name;

    return "";

A good idea is to add it as extension to the class SrsReportHelper and have it globally available.