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
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!
- \Data Dictionary\Tables\PrintMgmtReportFormat\Methods\populate
- \Data Dictionary\Tables\SRSReportDeploymentSettings\Methods\populateTableWithDefault
So here are my steps to make the new Design work:
1. Class PrintMgmtDocType
PrintMgmtDocType I customized the method
getDefaultReportFormat to return my new Design when the
... case PrintMgmtDocumentType::SalesAgreementConfirmation: case PrintMgmtDocumentType::PurchAgreementConfirmation: return ssrsReportStr(AgreementConfirmation, Report); ...
... 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
Name (representing the pattern ReportName.DesignName) and update the field
Name manually with your new Design name:
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.
Subscribe to robsCode
Get the latest posts delivered right to your inbox