SSRS Report Print management in D365

In order to add your customized report into Print management in D365, you needs to add an event handler to a delegate exposed by Microsoft.
Below is the example for Sales Invoice report

[SubscribesTo(classStr(PrintMgmtDocType), delegateStr(PrintMgmtDocType, getDefaultReportFormatDelegate))]
    public static void PrintMgmtDocType_getDefaultReportFormatDelegate(PrintMgmtDocumentType _docType, EventHandlerResult _result)
    {
        PrintMgmtReportFormatName formatName;
        #ISOCountryRegionCodes

        switch (_docType)
        {
            case PrintMgmtDocumentType::SalesOrderInvoice:
                // <GEEEE>
                if (SysCountryRegionCode::isLegalEntityInCountryRegion([#isoEE]))
                {
                    formatName =  ssrsReportStr(SalesInvoice, ReportEE);
                }
                // </GEEEE>
                // <GEELT>
                if (SysCountryRegionCode::isLegalEntityInCountryRegion([#isoLT]))
                {
                    formatName = ssrsReportStr(SalesInvoice, ReportLT);
                }
                // </GEELT>
                // <GEEHU>
                if (SysCountryRegionCode::isLegalEntityInCountryRegion([#isoHU]))
                {
                    formatName = ssrsReportStr(SalesInvoice, ReportHU);
                }
                // </GEEHU>
                // <GEELV>
                if (SysCountryRegionCode::isLegalEntityInCountryRegion([#isoLV]))
                {
                    formatName = ssrsReportStr(SalesInvoice, ReportLV);
                }
                // </GEELV>
                // <GEECZ>
                if (SysCountryRegionCode::isLegalEntityInCountryRegion([#isoCZ]))
                {
                    formatName = ssrsReportStr(SalesInvoice, ReportCZ);
                }
                // </GEECZ>
                // <GEEPL>
                if (SysCountryRegionCode::isLegalEntityInCountryRegion([#isoPL]))
                {
                    formatName = ssrsReportStr(SalesInvoice, ReportPL);
                }
                // </GEEPL>
                // <GTH>
                if (SysCountryRegionCode::isLegalEntityInCountryRegion([#isoTH]))
                {
                    formatName = ssrsReportStr(SalesInvoice, ReportTH);
                }
                // </GTH>
                // <GMY>
                if (SysCountryRegionCode::isLegalEntityInCountryRegion([#isoMY]))
                {
                    if (TaxParameters::find().GSTInvoiceFormat_MY == TaxGSTInvoiceFormat_MY::Full)
                    {
                        formatName = ssrsReportStr(SalesInvoice, ReportFull_MY);
                    }
                    else
                    {
                        formatName = ssrsReportStr(SalesInvoice, ReportSimplified_MY);
                    }
                }
                // </GMY>

                if (!formatName)
                {
                    formatName = ssrsReportStr(SalesInvoiceKAKA, Report);
                }

                _result.result(formatName);
        }
    }
Advertisements