How to call new Report/Design for existing Print management report. - Microsoft Dynamics 365 Vietnam

Microsoft Dynamics 365 Vietnam

Song Nghia - Microsoft Dynamics 365 Vietnam

Breaking

Thursday, April 18, 2019

How to call new Report/Design for existing Print management report.

Dynamics Ax 365 SSRS: How to call new Report/Design for existing Print management report.

Nghia Song

Tel - WhatsApp: +84967324794

Email: songnghia.uit@gmail.com


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.
Detail please follow up source code below :)
class hsPrintMgmtDelegatesHandler  
 {  
   /// <summary>  
   /// Delegate handler for the getDefaultReportFormatDelegate method of the <c>PrintMgmtDocType</c> class.  
   /// </summary>  
  
   [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>  
    
   /// <returns>The report format value.</returns>  
   private static PrintMgmtReportFormatName getDefaultReportFormat(PrintMgmtDocumentType _docType)  
   {  
     switch (_docType)  
     {  
       case PrintMgmtDocumentType::PurchaseOrderRequisition:  
         return ssrsReportStr(PurchPurchaseOrderCopy, Report);  
       case PrintMgmtDocumentType::PurchaseOrderConfirmationRequest:   /// <param name = "_docType">The <c>PrintMgmtDocumentType</c> enumeration value.</param>

         return ssrsReportStr(PurchPurchaseOrderCopy, Report);  
     }  
     return '';  
   }  
 }  
Surprise and good luck!