Dynamics Ax 365 SSRS: How to call new Report/Design for existing Print management report
March 16, 2018 3 Comments
Hi Dax guys,
I was working for a customer who was looking to implement custom designs on existing SSRS print management reports like purchase order confirmation report, for that requirement we created a new report with new design (Basically we copied the existing one and make changes to its design)
Now the problem was how to point print management framework to look for new report that we have designed.
Solution is :
Make a new extension class for example “hsPrintMgmtDelegatesHandler
” for PrintMgmtDocType class on method getDefaultReportFormatDelegate
and using that returns the custom report design name.
Complete code of extension class is given below.
class hsPrintMgmtDelegatesHandler
{
/// <summary>
/// Delegate handler for the getDefaultReportFormatDelegate method of the <c>PrintMgmtDocType</c> class.
/// </summary>
/// <param name = "_docType"><c>PrintMgmtDocumentType</c> enumeration value.</param>
/// <param name = "_result">The <c>EventHandlerResult</c> object.</param>
[SubscribesTo(classstr(PrintMgmtDocType), delegatestr(PrintMgmtDocType, getDefaultReportFormatDelegate))]
public static void getDefaultReportFormatDelegateHandler(PrintMgmtDocumentType _docType, EventHandlerResult _result)
{
PrintMgmtReportFormatName formatName = hsPrintMgmtDelegatesHandler::getDefaultReportFormat(_docType);
if (formatName)
{
_result.result(formatName);
}
}
/// <summary>
/// Gets the report format value.
/// </summary>
/// <param name = "_docType">The <c>PrintMgmtDocumentType</c> enumeration value.</param>
/// <returns>The report format value.</returns>
private static PrintMgmtReportFormatName getDefaultReportFormat(PrintMgmtDocumentType _docType)
{
switch (_docType)
{
case PrintMgmtDocumentType::PurchaseOrderRequisition:
return ssrsReportStr(PurchPurchaseOrderCopy, Report);
case PrintMgmtDocumentType::PurchaseOrderConfirmationRequest:
return ssrsReportStr(PurchPurchaseOrderCopy, Report);
}
return '';
}
}
Thank you brother
Hi Amir, It’s a nice post. Very mush useful.
If the Purchase order confirmation report (copied one) has two designs and they would be calling based on e.g. vendGroup ID. How this would be handled by PrintMgmtDocType class? at Print management setup you can define only one design format for original and one for copy.
Thanks,
Raj
Hi, how do you call each report? Is it through the controller?
Thanks