Sunday, January 24, 2016

Unable to connect to the AOS specified in the AX Client Configuration in SSRS

Today, I faced a really weird issue while designing a report in VS2012. After designing the report I tried building the solution and got the below error:

Error 1 Unable to connect to the AOS specified in the AX Client Configuration. The configuration could be missing, invalid, or the AOS is not running. To connect to the AOS, check the network connection between the client and the AOS, verify that a valid configuration exists and that the AOS service is running on the server. C:\Program Files (x86)\MSBuild\Microsoft\DynamicsTools\Microsoft.Dynamics.Framework.Design.Reporting.Modeling.targets 103 6 ReportModel2



Error 2 The "GenerateRdlTask" task failed unexpectedly.

Microsoft.Dynamics.Framework.BusinessConnector.Session.Exceptions.NoKernelSessionException: Unable to connect to the AOS specified in the AX Client Configuration. The configuration could be missing, invalid, or the AOS is not running. To connect to the AOS, check the network connection between the client and the AOS, verify that a valid configuration exists and that the AOS service is running on the server. --->


After trying the obvious things like verifying the SSRS & BC configurations and connectivity, I had to move to the boss "Google" and got out a really interesting thing about how Business Connector works:


"The root cause is the SSRS report file size is exceeding the limit, as there are multiple layouts for the report file, and each layout has several pictures embedded. So, the size was over 10M, we tried multiple times, the report can work correctly when the size is relatively small, but once over about 10M, the business connector cannot hold the report effectively and the connect is lost.


The solution is to create another SSRS file to have other layouts."


I had created a copy of the existing design which was exceeding the size so I deleted it and all worked fine.




Source: http://dynamicsuser.net/forums/t/84427.aspx

Friday, January 22, 2016

SSRS performance improvement

With one of our clients, we were facing this issue of reports loading really slow. Even the simple document reports were taking 2-3minutes to display data. So finally the solution came out that we need to increase the recycle time of the SSRS.

That's how to do this:
Navigate to "C:\Program Files\Microsoft SQL Server\MSRS11.MSSQLSERVER\Reporting Services\ReportServer" (depending on the SSRS version).

Look for file RSReportServer.config and open it.

Now find the tag "RecycleTime" from the default "720" to "1440". You can try increasing the value further depending on the performance.


Hope this helps. :)

Friday, December 11, 2015

Cross-Company-External record context

I faced a situation where I had to convert a listpage to cross company in EP. So I changed the query and redeployed. Pretty easy stuff. But then on clicking the record it opens a web control for approval and same thing happens with a button in the toolbar above. So in the case of cross company the web control was getting displayed blank as it wasn't getting the record context.

So I was able to handle the toolbar button by changing it's property "External Record Context" but couldn't handle the record link (HyperLinkButton). I tried getting the record context using IAxaptaAdapter but it didn't seem to work. :(


Wednesday, December 2, 2015

Cheque Report in Ax2012

Classes related to the Cheque report:
http://dynamicsuser.net/forums/p/59551/319006.aspx

https://stoneridgesoftware.com/dynamics-ax-development-check-basics/

Tuesday, December 1, 2015

Manually generate Number Sequence & release unused

The below code is to manually generate the number from the Number Sequence code:

numberSeq = NumberSeq::newGetNumFromCode(BankAccountTable::findByLedgerDimension(this.OffsetLedgerDimension).FundsTransferRefNum);

Sometimes we face this situation where number sequence doesn't release the unused numbers even if the Number sequence is configured as "Continuous". In that case we can use the below code:

NumberSeq::releaseNumber(NumberSequenceTable::findByNaturalKey(BankAccountTable::findByLedgerDimension(this.OffsetLedgerDimension).FundsTransferRefNum).RecId, ledgerJournalTrans_FundsTransfer.FundsTransferRefNum);

Conditionally hide Report Viewer buttons Ax2012

Today I was stuck in a situation where I had to disable the export button on the report viewer if the journal is not posted. After googling I got the below code which sits on the SRSReportViewer form:

private void hideExportButton()
{
    System.Windows.Controls.UIElementCollection elementLocal;
    Microsoft.Reporting.WinForms.ReportViewer   reportViewer;

    elementLocal = _AxReportViewer_Control.get_Children();
    reportViewer = elementLocal.get_Item(0);
    reportViewer.set_ShowExportButton(false);
}
Credit: http://www.agermark.com/2014/12/hide-export-button-from-report-viewer.html

You should have either different designs or menuItems for each condition to be called on the "init" method of the "SRSReportViewer" form. Add your custom code to call the hideExportButton where "_AxReportViewer_Control" is initialized.

// In case of multiple designs
    if(this.controller().parmReportName() like "*FundsTransferNoExport*")
    {
        this.hideExportButton();
    }
// In case of multiple menuitems
    if(this.args().menuItemName("*FundsTransfer*"))
    {
        this.hideExportButton();
    }

Monday, November 23, 2015

The formatter threw an exception while trying to deserialize the message Ax2012

Today I received below error first while deploying report then while viewing it:
The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://tempuri.org/:queryBuilderArgs. The InnerException message was 'Element 'http://tempuri.org/:queryBuilderArgs' contains data from a type that maps to the name 'http://schemas.datacontract.org/2004/07/XppClasses:SrsReportProviderQueryBuilderArgs'. The deserializer has no knowledge of any type that maps to this name. Consider using a DataContractResolver or add the type corresponding to 'SrsReportProviderQueryBuilderArgs' to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding it to the list of known types passed to DataContractSerializer.'.  Please see InnerException for more details.

The solution to this was:
1. Delete all records from SysClientSessions.
2. Restart AOS.
3. Restart SSRS.
4. If above steps don't work then you can also try deleting the existing report and redeploying. Or deleting AUC files. And also deleting the XPPIL folder and performing full CIL.

Or the best way when you face this error in production environment and cannot take a downtime:
Just deactivate and re-activate the BIServices Inbound Port and the magic is done.

Source:
https://community.dynamics.com/ax/f/33/t/112982