There can be reasons to add a new design to an SSRS report
  •  Have multiple designs side by side and print each for specific scenario
  • Have the new customized design deployed while preserving the original one
  • Have designs for different localization (As seen in AX default reports)
Its your choice. I used to keep the original report layout and fields so that I can get to the previous state whenever I want without worrying of any XPO imports. For a simple report, this may be as straightforward as mentioning the report deign name in the ssrsReportName method as follows;

However for control documents (reports generated at each specific state of a business document), this needs one more level of definition.

Set Custom design from code

Normally the report name is provided to the class as follows
controller.initArgs(_args, ssrsReportStr(SalesPackingSlip, report));

The ssrsReportStr method takes 2 parameters
  1. The report name - string
  2. The deisgn name - string
For control documents, this alone is not enough. Control document designs / formats are to be configured from the Print management feature provided in setup.

Path: -> Setup .> Forms -> Forms Setup
e.g. Accounts Payable > Setup > Forms > Forms Setup

The form provides each control document identified by the system and report and its format associated as default.

But your custom design won't appear in the configuration form unless a system class is modified for the same. There is a class with the name, "PrintMgmtDocType" with a method, 'getDefaultReportFormat()'. The default report design of a control document is resolved when the framework calls this method. You will notice that all the different localization based report formats are mentioned under the localization checks. In order for your custom design to appear in the configuration, you will have to return your custom design in some condition in this method.

For example, suppose you have added a new custom report design for sales invoice report. The code modification may look as follows;
case PrintMgmtDocumentType::SalesOrderInvoice:
if (SysCountryRegionCode::isLegalEntityInCountryRegion([#isoEE]))
    return ssrsReportStr(SalesInvoice, ReportEE);
return ssrsReportStr(SalesInvoice, CustomDesign);

You may add conditions like configuration key checks, company name, localization, menu item checks etc to decide which design to load.

Also note that these designs are originally built in the Visual Studio IDE (reporting tools extensions). When the AX model is build in visual studio and compiled in AOT, the new dsesign name is also available in X++ and would get compiled. Otherwise, the AOT may give error and may not recognize the new design. After the above code, the Print Management setup form would look like this;

Select the custom design and generate the particular control documents to see your new design in action :)
السلام عليكم و رحمة الله و بركاته
Hello and many congrats to all the readers for the new year. With the new year comes new challenges and their solutions. We continue to experience new hurdles and when we successfully handles them, create new blog posts to share our resolution with the readers. I wish this series of NEW thing continues to help us enhance our experiences to perform better in our professional careers :)

This new year eve I spent on my live client only to get surprise to see an error while deploying the changes that I made in the SalesInvoiceReport. After right clicking the report (emphasized due to recent changes)

Actually I added a new design to keep the original layout and created a new one. But all this complexity did not collaborated in the production of this error. I checked the report server is rightly configured in AX (validated the configuration to get all success), checked the report server configuration, it has to be fine since the all the reports were working fine flawlessly. 

Definitely there was something wrong due to some recent things I added. The SSRS report would compile OK, The DP and controller classes would compile fine. The model object... ahan. I compiled the model object to get a few errors. I cant remember the exact error now, and unfortunately I could not take any snapshot then, but one of the errors I remembered said 
'GenerateRdlTask failed'
Googling all this gave nothing exact for my problem. until I somehow looked in the windows event log which removed all the dark clouds in front of me and gave the real picture right in front of my eyes

Exception trace

Generation of the WCF configuration has failed, and the previously saved local configuration will be used.
Exception details:
System.InvalidOperationException: Unable to connect to a Microsoft Dynamics AX WCF service. Ensure that the Microsoft Dynamics AX AOS has fully started and that the requested WCF service is available. See the exception message below for details:
>Metadata contains a reference that cannot be resolved: 'http://myserver:8101/DynamicsAx/Services/MyMisConfiguredWebService'.
   at Microsoft.Dynamics.AX.Framework.Services.Client.Configuration.ClientConfigurationInternal.GetEndpointCollectionFromWsdlUri(String wsdlUri)
   at Microsoft.Dynamics.AX.Framework.Services.Client.Configuration.ClientConfigurationInternal.RetrieveIntegrationPortEndpoints(String aosServer, Int32 wsdlPort, List`1 portInfoList, Dictionary`2 endpointPortMap)
   at Microsoft.Dynamics.AX.Framework.Services.Client.Configuration.ClientConfigurationInternal.RetrieveEndpointsFromMetadata(String aosServer, Int32 wsdlPort, List`1 portInfoList, Dictionary`2 endpointPortMap)
   at Microsoft.Dynamics.AX.Framework.Services.Client.Configuration.ClientConfigurationInternal.ParseWsdlFromAos(String aosServer, Int32 wsdlPort, List`1 portInfoList)
   at Microsoft.Dynamics.AX.Framework.Services.Client.Configuration.ClientConfigurationInternal.GetClientConfiguration()

WCF Configuration

Initially I could not realize this error is related to my issue, deploying a changed report from AOT. But soon I realized this error will generate whenever I will attempt to deploy the report. This means that WCF configuration is always generated whenevr a report is attempted for deployment. I have ye to explore this things. I know that SSRS is based on WCF (and so is the new batch framework, SysOperationsFramework that is).

Architecture with dependency ?

But still should there be a new WCF configuration generation at deployment of each report ? Which will fail eventually if any web service endpoint is maliciously configured ? I think we definitely can have improvements here :)

The exception trace clearly mentions one of my test web service which was long stopped / moved whatever and was not taken care of since a lot of time. I saw a red "minus" icon (common for disabled or not working item representation) along with it. I deactivated it and then deployed the report. The report deployed with no more exceptions


Whenever a report is deployed, the WCF configuration is generated which can fail if any web service is misconfigured. The above stack trace confirms this.