In Dynamics AX, We being a developer has been asked by the client to display multiple reports set through Print Management. Free Text Invoice reports or Sales Order Confirmation and many other uses print management setups to call custom or OOTB reports so here below i have written query to find the report name setup on PMS(Print Management Settings).
Helper functions written to find the report name and this could be easily used in extension class
public static SRSCatalogItemName reportNameCheck()
{
PrintMgmtReportFormatName printMgmtReportFormatName;
PrintMgmtReportFormat printMgmtReportFormat;
PrintMgmtDocInstance printMgmtDocInstance;
PrintMgmtSettings printMgmtSettings;
select DocumentType , RecId from printMgmtDocInstance
where printMgmtDocInstance.DocumentType == PrintMgmtDocumentType::PurchaseOrderRequisition//in my case Enum value
join ParentId ,ReportFormat from printMgmtSettings
where printMgmtSettings.ParentId == printMgmtDocInstance.RecId
join RecId ,DocumentType , Name from printMgmtReportFormat
where printMgmtReportFormat.RecId == printMgmtSettings.ReportFormat &&
printMgmtReportFormat.DocumentType == PrintMgmtDocumentType::PurchaseOrderRequisition;
printMgmtReportFormatName = printMgmtReportFormat.Name;
return printMgmtReportFormatName;
}
Note: This is for sales order confirmation if you are using it for FreeTaxInvoice then
use Enum value as PrintMgmtDocumentType:: SalesFreeTextInvoice
Helper functions written to find the report name and this could be easily used in extension class
public static SRSCatalogItemName reportNameCheck()
{
PrintMgmtReportFormatName printMgmtReportFormatName;
PrintMgmtReportFormat printMgmtReportFormat;
PrintMgmtDocInstance printMgmtDocInstance;
PrintMgmtSettings printMgmtSettings;
select DocumentType , RecId from printMgmtDocInstance
where printMgmtDocInstance.DocumentType == PrintMgmtDocumentType::PurchaseOrderRequisition//in my case Enum value
join ParentId ,ReportFormat from printMgmtSettings
where printMgmtSettings.ParentId == printMgmtDocInstance.RecId
join RecId ,DocumentType , Name from printMgmtReportFormat
where printMgmtReportFormat.RecId == printMgmtSettings.ReportFormat &&
printMgmtReportFormat.DocumentType == PrintMgmtDocumentType::PurchaseOrderRequisition;
printMgmtReportFormatName = printMgmtReportFormat.Name;
return printMgmtReportFormatName;
}
Note: This is for sales order confirmation if you are using it for FreeTaxInvoice then
use Enum value as PrintMgmtDocumentType:: SalesFreeTextInvoice
Comments
Post a Comment