Wednesday, August 18, 2021

Call Custom Report Design using PrintMgmtDocType Event Handler in d365 FO

Call Custom Report Design in d365 FO 


class PrintMgmtDelegatesHandler  

 {  
   /// <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 = PrintMgmtDelegatesHandler::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 '';  
   }  
 }  

Reference : - https://msdax.wordpress.com/2018/03/16/dynamics-ax-365-ssrs-how-to-call-new-report-design-for-existing-print-management-report/

No comments:

Post a Comment