Friday, September 16, 2016

Fix space between menu items in the new AX7 menu

If you (like me) are bothered by the newly introduced space between menu items in the menu, then I have a solution :)


Screenshots

Original


With changed style

Procedure

Install the extension Stylish (or similar) in Chrome from the following link:
https://chrome.google.com/webstore/detail/stylish/fjnbnpbmkenffdnngjfgmeleoegfcffe?utm_source=chrome-ntp-icon

 And then set the style for cloudax.dynamics.com (or cloud.onebox.dynamics.com for local VM) to:

.modulesFlyout-last{
    margin-bottom: 0px !important;
}

.modulesFlyout-link{
    padding-bottom: 0px !important;
}

.modulesFlyout-LinkGroup.modulesFlyout-indent{
    margin-top: 0px !important;
    margin-bottom: 0px !important;
    padding-top: 1px;
    /*padding-bottom: 1px;*/
}

.modulesFlyout-LinkGroup:not(.modulesFlyout-indent){
    margin-bottom: 0px !important;
}

Thursday, June 16, 2016

Writing SSRS report directly to file / stream / byte array on AX7

If you ever need to write a report directly to a file, or for some reason get access to it before it is sent to the user, then you can replace your call to runReport on your SrsReportRun instance (similar code as when writing a report from code on AX 2012) with:

reportRun.parmReportContract().parmReportServerConfig(SRSConfiguration::getDefaultServerConfiguration());

SrsReportRunService reportRunService = new SrsReportRunService();
reportRunService.parmLocalMode(false);

reportRunService.preRunReport(reportRun.parmReportContract());


Microsoft.Dynamics.AX.Framework.Reporting.Shared.ReportingService.ParameterValue[]  parameterValueArray;
Map reportParametersMap;
reportParametersMap = reportRunService.createParamMapFromContract(reportRun.parmReportContract());
parameterValueArray = SrsReportRunUtil::getParameterValueArray(reportParametersMap);
SrsReportRunPrinter printer = new SrsReportRunPrinter(reportRun.parmReportContract(), parameterValueArray);

printer.parmSrsProxy().parmReportExecutionInfo(executionInfo);

System.Byte[] reportBytes = printer.parmSrsProxy().renderReportToByteArray(reportRun.parmReportContract().parmReportPath(),
                                          parameterValueArray,
                                          SRSReportFileFormat::PDF,
                                          printSettings.deviceInfo());

System.IO.File::WriteAllBytes("c:\\temp\\test.pdf", reportBytes);

If you need a stream instead, it should be trivial to create one with the byte array using the .net framework.