My colleague Rod showed it to me when I needed to add a new report to Project Invoice Proposal with billing rules to be present in Print management settings.
///
/// Subscribes to print mgmt report format publisher to populate custom reports
///
[SubscribesTo(classstr(PrintMgmtReportFormatPublisher), delegatestr(PrintMgmtReportFormatPublisher, notifyPopulate))]
public static void notifyPopulate()
{
#PrintMgmtSetup
void addFormat(PrintMgmtDocumentType _type, PrintMgmtReportFormatName _name, PrintMgmtReportFormatCountryRegionId _countryRegionId =
#NoCountryRegionId)
{
avrPrintMgtDocType_ProjInvReport_Handler::addPrintMgmtReportFormat(_type, _name, _name, _countryRegionId);
}
addFormat(PrintMgmtDocumentType::SIProjInvoiceWithBR, ssrsReportStr(avrPSAContractLineInvoice, Report));
}
///
/// Adds a report format to the printMgtReportFormat table
///
/// PrintMgmtDocumentType value
/// Name of the report (ie. reportname.Report)
/// Description of the report (ie. reportname.Report)
/// Country or default (#NoCountryRegionId)
/// True if this is a system report
/// SSRS report or another type
private static void addPrintMgmtReportFormat(
PrintMgmtDocumentType _type,
PrintMgmtReportFormatName _name,
PrintMgmtReportFormatDescription _description,
PrintMgmtReportFormatCountryRegionId _countryRegionId,
PrintMgmtReportFormatSystem _system =
false,
PrintMgmtSSRS _ssrs = PrintMgmtSSRS::SSRS)
{
PrintMgmtReportFormat printMgmtReportFormat;
select firstonly printMgmtReportFormat
where printMgmtReportFormat.DocumentType == _type
&& printMgmtReportFormat.Description == _description
&& printMgmtReportFormat.CountryRegionId == _countryRegionId;
if (!printMgmtReportFormat)
{
// Add the new format
printMgmtReportFormat.clear();
printMgmtReportFormat.DocumentType = _type;
printMgmtReportFormat.Name = _name;
printMgmtReportFormat.Description = _description;
printMgmtReportFormat.CountryRegionId = _countryRegionId;
printMgmtReportFormat.System = _system;
printMgmtReportFormat.ssrs = _ssrs;
printMgmtReportFormat.insert();
}
}
Then I can pick it up in Print management settings in Project module.
It may be a good idea to delete records from PrintMgmtReportFormat table; all its records will be recreated the next time you open Print management form.