Monday, February 18, 2019

Modification on existing report in D365

Create a new class from controller class


class CITSalesConfirmController extends SalesConfirmController
{
    public static CITSalesConfirmController construct()
    {
        return new CITSalesConfirmController();
    }

    public static void main(Args _args)
    {
        SrsReportRunController formLetterController = CITSalesConfirmController::construct();
        CITSalesConfirmController controller = formLetterController;
        controller.parmArgs(_args);
        controller.parmReportName(ssrsReportStr(CITSalesConfirmExt, Report));
        controller.parmShowDialog(false);
        controller.startOperation();
       
    }

}


Create a new / existing extension from output menu item

Go to the properties
  1. change the name to "new extension" of output menu item
  2. change the object to "new extension controller"

Duplicate the report from existing report

Go to the designs and click on report
  1. change the label names / text using expression property 

Added below code into the "PrintMgtDocTypeHandlers_ExtensionCIT" class (new class in your project)

 class PrintMgtDocTypeHandlers_ExtensionCIT
{
    [SubscribesTo(classstr(PrintMgmtDocType), delegatestr(PrintMgmtDocType, getDefaultReportFormatDelegate))]
    public static void getDefaultReportFormatDelegate(PrintMgmtDocumentType _docType, EventHandlerResult _result)
    {
        switch (_docType)
        {

// Call your report name here

            case PrintMgmtDocumentType::SalesOrderPackingSlip:
                _result.result(ssrsReportStr(CITSalesPackingSlipExt, Report));
                break;

// Call your report name here

            case PrintMgmtDocumentType::SalesOrderConfirmation:
                _result.result(ssrsReportStr(CITSalesConfirmExt, Report));
                break;
        }
    }

}

If report have print management option then follow the below setup

Set up print management for a module


Click Accounts receivable > Setup > Forms > Form setup. Click Print management
Click  your report module (Eg: Sales order confirmation) > Original <Default>
select your report name in "Report format" field


Deployment another way:

C:\AosService\PackagesLocalDirectoryECO\Plugins\AxReportVmRoleStartupTask\DeployAllReportsToSSRS.ps1 -Module CIT -ReportName CITSalesConfirm.ReportCAN -PackageInstallLocation "C:\AosService\PackagesLocalDirectoryECO"

If report have multiple language:

1. create same label names in different language files.
2. If it is still not  working then you have to follow the below code.

[ExtensionOf(ClassStr(SalesConfirmController))]
final class CITSalesConfirmController_Extension
{
    protected void modifyContract()
    {
        str invoiceaccount = custConfirmJour.InvoiceAccount;
        CustTable objcusttable = CustTable::find(invoiceaccount);
        str languageid =   objcusttable.languageId();

        this.parmReportContract().parmRdlContract().parmLabelLanguageId(languageid);
        next modifyContract();
        this.parmReportContract().parmRdlContract().parmLabelLanguageId(languageid);
    }

}

No comments:

Post a Comment

Finacial dimensions using ledger dimension / main account

Select * from objMainAccount  inner join                from objDimensionAttributeValueCombination                  where objDimensionAttrib...