Skip to main content
X++ Development · · 1 min read

Set Custom Customer Account Statement Report Format

 Set a custom SSRS report format for Customer Account Statements in D365 F&O using X++ and the PrintMgmtDocType delegate. 

Ahmad Hassan

Ahmad Hassan

Dynamics 365 F&O Consultant

Share
Set Custom Customer Account Statement Report Format

This customization subscribes to the PrintMgmtDocType report-format delegate to provide a custom SSRS report for customer account statements. When the document type is CustAccountStatement, the handler assigns CustAccountStatementExtCopy with the Report_CN design as the default report format.

X++ Code

{
    [SubscribesTo(classstr(PrintMgmtDocType), delegatestr(PrintMgmtDocType, getDefaultReportFormatDelegate))]
    public static void getDefaultReportFormatDelegate(PrintMgmtDocumentType _docType, EventHandlerResult _result)
    {
        switch (_docType)
        {
            case PrintMgmtDocumentType::CustAccountStatement: _result.result(ssrsReportStr(CustAccountStatementExtCopy, Report_CN));
            break;
        }
    }
     /// <summary>
    /// Event handler for the Inserting event on the CustAccountStatementExtTmp table.
    /// Sets the LogoDimension field by retrieving the dimension based on the AccountNum
    /// using the HAW_CustomerAccountstatement_EventHandler class.
    /// </summary>
    /// <param name=" ">The record being inserted CustAccountStatementExtTmp).</param>
    /// <param name="e">Event arguments (not used in this method).</param>

Process Flow

The getDefaultReportFormatDelegate subscribes to the PrintMgmtDocType default report-format delegate.

The method checks the supplied document type through a switch statement.

When the document type is CustAccountStatement, the CustAccountStatementExtCopy report with Report_CN design is assigned as the result.

e77004c2-61a5-4d6a-a368-72a1b0a3b5ef.png

Figure: Flow of assigning a custom SSRS report format for Customer Account Statements.

Found this useful?

Share it with your network

Ahmad Hassan

Written by

Ahmad Hassan

Microsoft Dynamics 365 & Power Platform blogger.

More about me

Related Posts

Comments

Leave a comment