[SSRS] AgreementConirmation add new Design

I tried to add a new Design to the Report AgreementConfirmation recently and struggled to get the new Design printed out.

My approach was to set the parmReportName() in the main method of the AgreementConfirmationController class.
Unfortunately that doesn't worked. The default Design Report always got printed.
After digging deeper with the debugger, I found out that there are some places in Standard Dynamics AX 2012 where some methods has Report Layouts hard coded. That's really nasty!
Some examples:

  • \Classes\PrintMgmtDocType\getDefaultReportFormat
  • \Data Dictionary\Tables\PrintMgmtReportFormat\Methods\populate
  • \Data Dictionary\Tables\SRSReportDeploymentSettings\Methods\populateTableWithDefault

hard coded standard report designs So here are my steps to make the new Design work:

1. Class PrintMgmtDocType

In Class PrintMgmtDocType I customized the method getDefaultReportFormat to return my new Design when the PrintMgmtDocumentType is PrintMgmtDocumentType::PurchAgreementConfirmation:

Standard:
...
        case PrintMgmtDocumentType::SalesAgreementConfirmation:
        case PrintMgmtDocumentType::PurchAgreementConfirmation:
            return ssrsReportStr(AgreementConfirmation, Report);
...
Customized:
...
        case PrintMgmtDocumentType::SalesAgreementConfirmation:
            return ssrsReportStr(AgreementConfirmation, Report);
        case PrintMgmtDocumentType::PurchAgreementConfirmation:
            return ssrsReportStr(AgreementConfirmation, ReportPurch);
...

This method is called in \Data Dictionary\Tables\PrintMgmtReportFormat\Methods\populate and initializes the Records in table PrintMgmtReportFormat with default Designs (hardcoded!).

2. A) ReRun PrintMgmtReportFormat::populate

You can uncomment line 73 in method populate on table PrintMgmtReportFormat to repopulate the records.
Attention! This deletes the entire table and rebuilds it from scratch. May break all exsting formats used on a PrintMgmtSettings record if Design has changed!

2. B) Change single record manually

If only one Design has changed (like in this example), I recommend this method!
Navigate to the table PrintMgmtReportFormat under \Data Dictionary\Tables\PrintMgmtReportFormat and view it with the TableBrowser.
Find your record by filtering for DocumentType or Name (representing the pattern ReportName.DesignName) and update the field Name manually with your new Design name:
Change Table record field Name

Conclusion

When changing the default format, there is no need to override the parmReportName() anymore in the Controller class. With the most reports the parmReportName() method will do the work, but in such special cases, it's good to know what to look for.

Robin

Software Engineer / Application Developer

Subscribe to robsCode

Get the latest posts delivered right to your inbox.

or subscribe via RSS with Feedly!