Friday, February 5, 2021

Customizing standard report in Dynamics 365 finance and operations

In this article we will introduce how to customize payment advice report. The example will be base on Vendor payment advice. If need apply on Customer payment advice, just need change vend to cust and check same.

1.      Related Objects

Report: BankPaymAdviceVend

Class: BankPaymAdviceVendController, BankPaymAdviceVendPrint, PrintMgtDocTypeHandlerExt

Output MenuItem: BankPaymAdviceVend

2.      Create model

Go to Dynamics 365àModel Management àCreate model


3. Click Next

4. Click Next, Select ApplicationFoundation and ApplicationSuite

5. Create Next and Create new project



6.      From AOT, find Report BankPaymAdviceVend

If you want how to find it is this report. You can find the Payment advice button from payment journal and it’s menu item BankPaymAdviceVendPrint, then you can find it calls class BankPaymAdviceVendPrint, and this class call menu item BankPaymAdviceVend



7. Then menu item calls controller BankPaymAdviceVendController, this controller call report BankPaymAdviceVend.



8. Duplicate the report and rename to BankPaymAdviceVendExt



9. Then Open BankPaymAdviceVendExt and apply the customizations you want.



10. For example:



11.      Deploy report

Right click the project and Rebuild, if no any errors, then Right click the project and Deploy reports



12.      Create a new class that extends the standard controller-- BankPaymAdviceVendController.

Right click ProjectàAddàNew Item…àClass, name BankPaymAdviceVendControllerExt



13. Override main method to specify the controller and report (Copy from BankPaymAdviceVendController and change).

class BankPaymAdviceVendControllerExt extends BankPaymAdviceVendController

{

    public static void main(Args _args)

    {

        SrsReportRunController controller = new BankPaymAdviceVendControllerExt();

        controller.parmReportName(ssrsReportStr(BankPaymAdviceVendExt, Report));

        controller.parmArgs(_args);

        controller.parmShowDialog(false);

        controller.startOperation();

    }

 

}

14.      Add customized report into default payment advice report list in print management.

Add a new class to the project. Name as PrintMgtDocTypeHandlerExt to distinguish it from other object handlers.

Add a delegate handler method to start to use custom report. In this example, extend the getDefaultReportFormatDelegate method in the PrintMgtDocTypeHandlerExt class by using the following code.

class PrintMgtDocTypeHandlerExt

{

    [SubscribesTo(classstr(PrintMgmtDocType), delegatestr(PrintMgmtDocType, getDefaultReportFormatDelegate))]

    public static void getDefaultReportFormatDelegate(PrintMgmtDocumentType _docType, EventHandlerResult _result)

    {

        switch (_docType)

        {

            case PrintMgmtDocumentType::VendPaymAdvice:

                _result.result(ssrsReportStr(BankPaymAdviceVendExt, Report));

                break;

        }

    }

 

}

15.      Create a extension of output menu item BankPaymAdviceVend


16. Right click and Open it, then change Object property to BankPaymAdviceVendControllerExt


17.      Change print management settings

Go to Accounts payableàFormsàForm setup, on General tab, click Print management

Find payment advice and right clickàNew, select the report you created.


18.      Find a vendor payment journal and try



 Hope this helps !, I will come-up with another interesting topic!

2 comments:

  1. Hi Jayaprakash,

    I working on a customization to add few fields in BankPaymAdviceVend report. Is it possible to add new fields to the data source of this report and then bring it on to the report? If yes, can you post here screen shots?

    ReplyDelete
    Replies
    1. Hi Karan,

      You can not add design to existing report, but you can add for new design by just duplicating the standard design as described in this blog post.
      1. Try to find datasource table in D365FO and extend the table and add new fields required.
      2. Populate the field values in DP class by extending the same.
      3. Then Duplicate the report and refresh the dataset, then you should be able to add newly added fields.

      Delete