Thursday, September 16, 2021

How to customise standard report in D365 FO

 Find the menu item, in my case I am taking "TaxTrans"

Create extension for same

go to the class on the menu item and create extension of same class, in my case my class was "TaxTransController"

I created a new extension class of controller class

class GITS_TaxTransControllerExt extends SrsReportRunController


    public static client void main(Args _args)


        GITS_TaxTransControllerExt Controller;

        Controller = new GITS_TaxTransControllerExt();







Now dublicate the report in your project area and look for dp class

Now create a new extension class "GITS_TaxTransDP_Extension" for the DP class, in my case dp class was "TaxTransDP"

Also create extension of temp table and add the required fields

Write the following code and update logic accordingly


final class GITS_TaxTransDP_Extension


    [PostHandlerFor(classStr(TaxTransDP), methodStr(TaxTransDP, processReport))]

    public static void TaxTransDP_Post_processReport(XppPrePostArgs args)


        TaxTrans    lclTaxTrans;       

        TaxTransDP dpInstance = args.getThis() as TaxTransDP;

        TmpTaxTransReport lclTmpTaxTransReport = dpInstance.getTaxTransTmp();


        while select forupdate lclTmpTaxTransReport


            select sum(TaxBaseAmount) from lclTaxTrans

                where lclTaxTrans.Voucher   == lclTmpTaxTransReport.Voucher;

            lclTmpTaxTransReport.TaxBaseAmount  = lclTaxTrans.TaxBaseAmount;






Now Build and deploy

Tada !!!