Call new Report/Design for existing Print management report in D365fo

  • Duplicate the PurchPurchaseOrder standard Report as PurchPurchaseOrderReport.
  • Go to printMgmtDocType class and copy the event handler delegate method called getDefaultReportFormteDelegate.
  • Create new class "PrintMgmtDocDelegatesHandler" and paste the EventHandler.
  • Below is the reference code. To execute the report different design per each legal entity

class PurchPurchaseOrderDelegate
{   
    [SubscribesTo(classStr(PrintMgmtDocType), delegateStr(PrintMgmtDocType, getDefaultReportFormatDelegate))]
    public static void PrintMgmtDocType_getDefaultReportFormatDelegate(PrintMgmtDocumentType _docType, EventHandlerResult _result)
    {
        PrintMgmtReportFormatName formatName = sfcPurchPurchaseOrderDelegate::getDefaultReportFormat(_docType);
        if (formatName)
        {
            _result.result(formatName);
        }
    }

    private static PrintMgmtReportFormatName getDefaultReportFormat(PrintMgmtDocumentType _docType)
    {

        switch (_docType)
        {
            case PrintMgmtDocumentType::PurchaseOrderRequisition:
                {
                    if(curExt() == "USMF")//Company Name
                    {
                        return ssrsReportStr(PurchPurchaseOrderReport, Report);
                    }                    

                }
            case PrintMgmtDocumentType::PurchaseOrderConfirmationRequest:
                {
                    if(curExt() == "RUMF") //Company Name
                    {
                        return ssrsReportStr(PurchPurchaseOrderReport, Report);
                    }                    
                }
        }
        
        PrintMgmtReportFormatSubscriber::populate();

        return '';
    }

}

Once we done this,Need to go to AP-Setup-Form-Form setup-> Print Management button then in that format have to select the that related Purchase order report in the dropdown.






Comments

Popular posts from this blog

Assembly reference containing type is not referenced, Object 'CLRObject' could not be created

Send email using .Net framework

Extract data of PO from the System in Ax 2012