Home > Dynamics AX > How to override Sales Invoice report with custom report?

How to override Sales Invoice report with custom report?

How to change/replace/override Sales Invoice report with new report/design? There are one main thing you need to change in order to change to new report/design. It is override the SalesInvoiceController.outputReport method. Please refer to code below:

//SalesInvoiceController class
protected void outputReport()
{
    //....
    PrintMgmtPrintSettingDetail detail = formLetterReport.getCurrentPrintSetting();
    //....

    //At the end of the code
    detail.parmReportFormatName(ssrsReportStr(SalesInvoice, YourNewDesign));
}

If you want further control what report you want to print, you can change the main method code in SalesInvoiceController, the Sales Invoice menu by passing correct argument to the menu, and finally add logic to control what report to print in outputReport method above. For example:

//SalesInvoiceController class
public static void main(Args _args)
{
    //....
    if (_args.parmEnumType() == enumNum(MyReportType))
    {
        if (_args.parmEnum() == MyReportType::Invoice)formLetterController.parmReportType(MyReportType::Invoice);
    }
    _args.parmEnumType(enumNum(PrintCopyOriginal));
    _args.parmEnum(PrintCopyOriginal::Original);

    //Original code
    formLetterController.parmShowDialog(false);
    formLetterController.startOperation();
}    
Advertisements
Categories: Dynamics AX Tags: , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: