real solutions for real problems
Welcome to MSDN Blogs Sign in | Join | Help

How does the AX Hotfix / Service Pack installer detect existing AOS instances

Have you ever wondered how the AX Hotfix / Service Pack installer detects existing AOS instances?

These information can be found in the Installer Registry under the following Registry Key:

HKEY_CLASSES_ROOT\Installer\Products

Every AOS Instance has it's own class Id.
This class id looks like this FA15D12F8BB2D1C4282780DBCF31Axxx (where xxx is a uniqe number).

For example:
If I have 2 AOS instances on my machine then I may find the following registry keys:

HKEY_CLASSES_ROOT\Installer\Products\FA15D12F8BB2D1C4282780DBCF31A110
HKEY_CLASSES_ROOT\Installer\Products\FA15D12F8BB2D1C4282780DBCF31A120

Additional information
If those keys have a subkey named Patches then they are marked as updated.
The entries in this subkey contain information about the applied patches.

Posted by EMEAAXTec | 2 Comments
Filed under: ,

Workflow - user abc has no access to menu item PurchReqTable

Lately for one of the user I run into following problem with Purchase approval workflow. During Workflow process assignment customer get error and Workflow is stopped. We get following error:

"User abc has no access to menu item PurchReqTable.” where abc is user to who workflow item should be assign

The root cause of this behavior was of course connected with user permissions. User had too low permission to be able to assign to needed task item. It happens that user was missing permission: Accounts payable -> Miscellaneous
First of all when you assign the permission to Workflow on permission form you should change Viewing from "Security" to "Workflow", then you are able to assign needed permission for selected Workflow. Although when you assign all permission for Accounts payable -> Purchase requisition -> Project purchase requisition approval you still get the same error. I found that menu item PurchReqTable in \ AOT \ Menu items \ Display \ PurchReqTable and I found out that security key assign to this menu item is: VendMisc So in Security view you need to assign user permission Accounts payable -> Miscellaneous
Posted by EMEAAXTec | 0 Comments
Filed under: ,

Query execution failed for data set 'Company'

Recently we were having problems to get the Role Center up and running. Report Server is setup and working in a correct way. Most reports can be generated, but a few does not answer correct. For those report the following error is generated: “Query execution failed for data set 'Company'” Reports in Role Center can not be accessed. Even those that default company was set in Business Connector Configuration Utility and on the connection tab correct AOS was set up we were still not able to make report working.
The root cause of this problem was that cubes in OLAP database DynamicsAX were not processed.
To solve the problem we were following WhitePapers which let us configure cubes and Role Center:

  1. The “Configure the Default OLAP Cubes” white paper and the cross-reference document are now available here: http://www.microsoft.com/downloads/details.aspx?FamilyId=28CDB057-416A-497E-A7E0-8D52C4EB1BFB&displaylang=en
  2. Microsoft Dynamics AX 2009 White Paper: Configuring Kerberos Authentication with Role Centers: http://www.microsoft.com/downloads/details.aspx?FamilyID=be720eb3-649a-49ff-b019-a1e4e7af6b47&DisplayLang=en
  3. Microsoft Dynamics AX 2009 White Paper: Configuring Enterprise Portal and Role Centers with SQL Reporting http://www.microsoft.com/downloads/details.aspx?FamilyID=3D2463FC-EA13-40EF-A375-2DA2F379652C&displaylang=en
  4. Fixing Microsoft Dynamics AX Cube Processing Errors Caused by EDT Field Changes: https://mbs.microsoft.com/partnersource/documentation/whitepapers/AX2009_FixCubeProcessingErrors

The way how we troubleshoot the problem was following. We had problem with report ProjUtilizationEffeciencyEmpl.

Report ProjUtilizationEffeciencyEmpl is based on Project Accounting Cube.

If Company data set cannot be processed it seems there is something wrong with this cube. Company data set is called with following query:

WITH
MEMBER [Measures].[ParameterCaption] AS '[Company].[Company accounts].CURRENTMEMBER.MEMBER_CAPTION'
MEMBER [Measures].[ParameterValue] AS '[Company].[Company accounts].CURRENTMEMBER.UNIQUENAME'
MEMBER [Measures].[Key] AS '[Company].[Company accounts].CURRENTMEMBER.Properties("Key")'
SELECT {[Measures].[ParameterCaption], [Measures].[ParameterValue], [Measures].[Key] } ON COLUMNS , Except([Company].[Company accounts].MEMBERS, {[Company].[Company accounts].[All], [Company].[Company accounts].[Unknown]})
ON ROWS FROM [Project Accounting Cube]

Using the DLLFunction kernel class on a 64bit Dynamics AX 2009 AOS

One of the nice features added with Dynamics AX 2009 is the support for 64bit (x64) for the Dynamics AX 2009 Application Object Server and the Dynamics AX 2009 .NET Business Connector.

However when you have some existing X++ that you are now migrating to Dynamics AX 2009, you might run into an issue when you are using the DLLFunction kernel class and try to execute the code on a 64bit AOS.

When you are trying to use the DLLFunction kernel class on a 64bit AOS the execution of the method call will result in the following error message:

Function 'FunctionName' in DLL library ‘DLLName' has caused an exception.

When you are executing exactly the same code on a 32bit AOS, the execution will work (assuming the parameters of the DLLFunction were set correctly).

Background of this issue is, that on 64bit the DLLFunction kernel class itself is not implemented in Dynamics AX 2009.

If you are in a situation where you need to make a call to an external WinAPI DLL, you need to look for alternatives:

  1. Can the call to the external DLL moved to the Client tier? As the Dynamics AX 2009 Client is still 32bit, the DLLFunction kernel class is here existing as it was in the past.
     
  2. Does there exist an equivalent of the WinAPI DLL? If the WinAPI DLL is used to communicate with an external component maybe different communication interfaces exist, like COM Components or .NET Assemblies. Those can still be used.
     
  3. Can a .NET wrapper Assembly be created? If no existing equivalent .NET Assembly is available you might be able to create yourself a wrapper you can reference in Dynamics AX 2009. Inside the wrapper you can simply pass on the calls to the WinAPI DLL. For more information see Consuming Unmanaged DLL Functions and Platform Invoke Tutorial.
     
Posted by EMEAAXTec | 0 Comments
Filed under: , , ,

The Dynamics AX Client sometimes terminates when displaying certain HTML pages in a Web browser control

In Dynamics AX 2009 several Forms exists that have a Web browser control to display either dynamically created HTML content or show certain web pages based on the context of a selected record in a Grid. The Web browser control enriches the user experience this way.

However sometimes it might happen when you open such a Form or change the record context so a different HTML page gets displayed the Dynamics AX client terminates. If the Dynamics AX Client terminates or not mainly depends what kind of content is being displayed in the Web browser control.

HTML pages do often also host interactive objects to enrich their user experience. If on such a HTML page SilverLight content is embedded, event if it is just for advertisements, exactly the described issue will happen. Background of this issue is the misinterpretation of a WM_USER Windows Message by the Dynamics AX Client.

Fortunately this issue was recently solved with the Kernel Hotfix KB968840 that is also included in the Rollup 2.

Posted by EMEAAXTec | 0 Comments
Filed under: , , ,

List of fixes that improve performance of certain features in Dynamics AX 2009

Over the last month different fixes for Dynamics AX 2009 and Dynamics AX 2009 Service Pack 1 were release to optimize specific functionality and features that were not showing an optimal performance in all situations. Most of the fixes were released as Application fixes, which means they either need to be installed individually one by one or by integrating a whole Rollup.

Below you find a list of fixes that were released for Dynamics AX 2009 and Dynamics AX 2009 Service Pack 1 together with an indication in which Rollup they are included. However please be aware that the following list is not complete.

If you are not finding in this list what you a looking for, a search in the Knowledge Base is definitely a good idea!

Issue Fix type Fix included in
KB974830 - You experience slow performance when you try to start the Microsoft Dynamics AX 4.0 client in a closed network or in a perimeter network KB Fix  
KB959598 - Microsoft Dynamics AX stops responding if many clients are opened or closed at the same time in Microsoft Dynamics AX 2009 Application RTM RU-1
SP1 RU-1
KB956422 - You experience slow performance when you select a transaction in the "Account transactions" dialog box in Microsoft Dynamics AX 2009 Application RTM RU-1
SP1 RU-1
KB956338 - You experience slow performance when you export a whole layer in Microsoft Dynamics AX 2009 Hybrid RTM RU-1
SP1 RU-1
KB957436 - You experience slow performance when you create a journal that contains many journal lines in Microsoft Dynamics AX 2009 Application RTM RU-1
SP1
KB967851 - You experience slow performance when you change general ledger journals in Microsoft Dynamics AX 2009 KB Fix  
KB967203 - You experience slow performance when you post inventory journals that contain many positions in Microsoft Dynamics AX 2009 Application RTM RU-1
SP1 RU-1
KB967799 - You experience slow performance or Microsoft Dynamics AX crashes when you print the BOMConsistOf report to a PDF file in Microsoft Dynamics AX 2009 with Service Pack 1 Application SP1 RU-1
KB971155 - You experience slow performance when you set the setup name to "Return order" in the "Arrival overview" dialog box in Microsoft Dynamics AX 2009 Application SP1 RU-2
KB973493 - You experience slow performance when you try to view the Totals information or the Sales Tax information of a sales order in Microsoft Dynamics AX 2009 KB Fix  
KB972404 - Microsoft Dynamics AX 2009 Service Pack 1 creates an SQL query that causes a slow performance issue for ad hoc reports when you update a report model Application SP1 RU-3
KB972964 - You experience slow performance when you delete a record from certain tables in Microsoft Dynamics AX 2009 with Service Pack 1 installed Kernel SP1 RU-3
KB974706 - You experience slow performance when you open the DirPartyTable form in Microsoft Dynamics AX 2009 Application SP1 RU-3
KB975088 - You experience slow performance when you open the "Print management setup" form in Microsoft Dynamics AX 2009 Application SP1 RU-3
KB974351 - You experience slow performance when you type a search text to look up records in the "Item number" field in a sales order line in Microsoft Dynamics AX 2009 Kernel RTM RU-3
SP1 RU-3
KB973439 - The workflow keeps retrying when a time-out exception error occurs in Microsoft Dynamics AX 2009 with Service Pack 1 installed Application SP1 RU-3
Performance issue in "Open Transaction Edit" form SE BLOG  
Posted by EMEAAXTec | 0 Comments
Filed under: ,

Renaming an AOT object in Dynamics AX 2009 that is under source control with Team Foundation Server

With the support of version control systems (VCS) in Dynamics AX 4.0 and the integration in the AOT a lot of effort was put into the product to make the development in teams more efficient and reduce the chance of conflicts. Dynamics AX 2009 continues this effort with the support of additional version control systems like Microsoft Team Foundation Server (TFS).

The adding of objects in the AOT to source control is straight forward as well as the checking in and checking out. When you are however trying to rename an object that is under source control you might get some unexpected effects if you are using Team Foundation Server as your VCS; actually it’s not you, but the other developers in your team that experience the unexpected effects.

So lets imagine you have an AOT object, e. g. a class object ClassA, that is under source control and in a checked out state. You are a developer and decide to rename the class to ClassB and do a check in. When now a different developer in your team that has already ClassA existing decides to retrieve the latest changes from your VCS (do a synchronization), the developer will get confronted with an error message that another object with the same id already exists and the existing object ClassA isn't renamed to ClassB.

The root cause of the issue is that the object was in a checked out state when it was renamed and later checked in. When you do a rename of an AOT object that is under source control the object has to be in a checked in state when you do the rename (see also: How to: Rename AOT Objects in the Version Control System)!

On the other hand Dynamics AX 2009 should not run into this error state and therefore the Hotfix KB972037 was released to prevent this issue from happening in the future.

Please go to the Microsoft Dynamics AX 2009 SDK on MSDN if you want to know more about using a VCS in Dynamics AX 2009.

Posted by EMEAAXTec | 0 Comments

Debugging non-interactive X++ code in Dynamics AX 2009 when running on Windows Server 2008

The most common scenario for a Dynamics AX developer is that you create your X++ code and objects in the Dynamics AX Client and test them in the same interactive session. In other words you start executing your new code from within the Dynamics AX Client and if necessary debug the code by putting in some breakpoints and wait for the Dynamics AX Debugger to hit them.

There are however also scenarios where the code you have developed needs to be executed in a non-interactive session, and with the release of Dynamics AX 2009 the chances to get confronted with this are much higher because the concept of Batch Jobs has changed.

Unlike earlier versions of Dynamics AX you don’t need to have in Dynamics AX 2009 a Batch Client running any more, as the AOS is now responsible for executing Batch Jobs (that support the new Batch Framework).

The important part is that the X++ code of the Server Batch Jobs is executed on the AOS in a non-interact session, and this changes also the way how you need to debug the X++ code.

The easiest way is still trying to avoid the non-interactive part, in other words trying to execute the code running in the non-interactive session in an interactive session by creating some helper/wrapper classes and calling them from the Dynamics AX Client. However sometimes the error you are facing does only occur in the non-interactive session.

You can still instrument your code (build in some logging) and evaluate the output (log), however still you can reach a point where you have no other choice than debugging the code in the non-interactive session. For those of us that have developed Enterprise Portal Web Forms in the past the concept is very similar, as here you are also dealing with a non-interactive session.

In order to do non-interactive debugging, you need to prepare your environment and make some configuration changes. I don’t want to go into too much detail what you have to do, as I found some excellent posts and just want to refer to them instead:

Once you have set up everything correctly, you might however face the issue that the Dynamics AX 2009 Debugger does not stop at your breakpoint.

This is the case when either the AOS for Server Batch Jobs or the .NET Business Connector for Enterprise Portal are running on Windows Server 2008. In this environment the Dynamics AX 2009 Debugger will never connect to your non-interactive session and so never hit any breakpoint!

There was recently the Hotfix KB962952 released for Dynamics AX 2009 SP1 that addresses this issue. If you want to debug X++ code in a non-interactive session in Dynamics AX 2009 and you are running on Windows Server 2008 you need to install this Hotfix!

Once the Dynamics AX 2009 Debugger is attached to your non-interactive session the experience you get is the same as if you would debug interactive sessions.

Posted by EMEAAXTec | 0 Comments

Unable to install Dynamics AX 2009 Analysis extensions when the default SQL Server Analysis Server collation is set to Turkish_CI_AS or Turkish_CS_AS

We came across an issue where by after installing the Dynamics AX 2009 Analysis Extensions sucessfully, no database is created! Even if you manually try to create the Dynamics AX Analysis database from the analysis script file DynamicsAX.xmla (found under the installation media in "\support\Analysis Services\Scripts\" folder), you get the following error message:

<BR><return xmlns="urn:schemas-microsoft-com:xml-analysis">
  <results xmlns="http://schemas.microsoft.com/analysisservices/2003/xmla-multipleresults">
    <root xmlns="urn:schemas-microsoft-com:xml-analysis:empty">
      <Exception xmlns="urn:schemas-microsoft-com:xml-analysis:exception" />
      <Messages xmlns="urn:schemas-microsoft-com:xml-analysis:exception">
        <Error ErrorCode="3239313662" Description="Errors in the metadata manager. The attribute with ID of ''''Description'''', Name '''''''' of referenced by the '''''''' cube dimension, does not exist." Source="Microsoft SQL Server 2008 Analysis Services" HelpFile="" />
      </Messages>
    </root>
    <root xmlns="urn:schemas-microsoft-com:xml-analysis:empty">
      <Exception xmlns="urn:schemas-microsoft-com:xml-analysis:exception" />
      <Messages xmlns="urn:schemas-microsoft-com:xml-analysis:exception">
        <Error ErrorCode="3239313412" Description="Errors in the metadata manager. Either the database with the ID of ''''Dynamics AX'''' does not exist in the server with the ID of ''''ANUP209'''', or the user does not have permissions to access the object." Source="Microsoft SQL Server 2008 Analysis Services" HelpFile="" />
      </Messages>
    </root>
  </results>
</return>

We got this issue on a SQL Server Analysis Server (SSAS) 2008 where the default collation was set to Turkish_CI_AS. The same will apply if you were running SQL Server 2005 and also with Turkish_CS_AS collation. This is by design as the Analysis extensions (OLAP framework tools and Default Cubes) have been tested only in the following AX language/collation combinations:


Language     SSAS Collation
English US   Latin1_General_CI_AS 
Danish         Danish default collation 
German       German default collation 
Chinese       Chinese default collation 
Arabic          Arabic default collation


You maybe able to workaround the issue as follows:

- In SQL Server Management Studio, connnect to SSAS and right click on the server name to change the properties of collation .
- Set your collation to Latin1_General for instance and restart SSAS
- Run the AX setup to add the "Analysis extensions".
- When the DynamicsAX database and its cubes have been created, you could either change back SSAS collation to Turkish_Cx_Ax, or first backup the database, then change SSAS collation to Turkish_Cx_Ax and restore the backup.



Error during processing of 'AX_CompanyName' report parameter. (rsReportParameterProcessingError)

We came across an issue recently where the Dynamics AX 2009 reporting extensions and sql reporting services reports deployed successfully. However when trying to browse and view ANY of the published reports on the SQL Reporting server or via role centers we get the following error displayed: 

Error during processing of ‘AX_CompanyName’ report parameter. (rsReportParameterProcessingError)


and furthermore in the Windows Application Event log on the SQL Reporting server we get the following error logged:

Event Source: Microsoft.Dynamics.Framework.BusinessConnector
Event Category: None
Event ID: 1000
Description:
Dynamics Adapter LogonAs failed.

Microsoft.Dynamics.BusinessConnectorNet.NoIISRightsException
at Microsoft.Dynamics.BusinessConnectorNet.Axapta.Logon(BC_PROXY_ACCOUNT_INFO* pBCProxyAccountInfo, String company, String language, String objectServer, String configuration)
at Microsoft.Dynamics.BusinessConnectorNet.Axapta.LogonUsingBCProxyAccount(_SEC_WINNT_AUTH_IDENTITY_W* pImpersonatedUserAccount, NetworkCredential bcProxyCredentials, String company, String language, String objectServer, String configuration)
at Microsoft.Dynamics.BusinessConnectorNet.Axapta.LogonAs(String user, String domain, NetworkCredential bcProxyCredentials, String company, String language, String objectServer, String configuration)
at Microsoft.Dynamics.Framework.BusinessConnector.Session.DynamicsAdapter.LogonAs(String user, String domain, NetworkCredential bcProxyCredentials, String company, String language, String objectServer, String configuration)

After further troubleshooting we identified that the user was not licensed for the "Enterprise Portal Framework" module. SQL Reporting extensions and integration uses the .NET Business Connector (BC.NET) and BC.NET requires Enterprise Portal Framework license, even if you are not using Role Centers and Enterpise Portal. When the business connector connects to the AOS server if it does not find the license key, it throws the NoIISRightsException error message as seen in the event log.
 
To check whether you are licensed, run the Dynamics AX Client and go to Administration -> Setup -> System Information -> License Information and click on the Web tab

For more info see KB 931939, although written for AX 4.0 it is still applicable

You get the following warning message in BizTalk Server 2006 R2/2009 - The message does not contain a body part

We came across an issue where you are using Microsoft Dynamics AX 2009 Asynchronous BizTalk Adapter to receive response messages from AX 2009. After just having sent an AIF UPDATE or DELETE Action message to AX, the BizTalk Server fails to consume the response message that is generated by AX. The receive location using the AX Adapter is using the default xml receive pipeline, and the "Pass Through" property of the adapter is set to 'False'

You get the following error logged in the Application Event log on the BizTalk Server:

Source:        BizTalk Server 2006
Event ID:      5740
Task Category: BizTalk Server 2006
Level:         Warning
Description:
The adapter "Microsoft Dynamics AX 2009" raised an error message. Details "The message does not contain a body part.".

This error is "by-design", as the Response message generated after a successful UPDATE and DELETE AIF actions does not contain a message part. Here is a sample response message:

<?xml version="1.0" encoding="utf-16"?>
<Envelope xmlns="http://schemas.microsoft.com/dynamics/2008/01/documents/Message">
  <Header>
    <MessageId>{F0FBBBBE-2231-4529-87BA-C5F69F0663F3}</MessageId>
    <SourceEndpoint>Default</SourceEndpoint>
    <DestinationEndpoint>Default</DestinationEndpoint>
    <Action>http://schemas.microsoft.com/dynamics/2008/01/services/SalesOrderService/delete</Action>
    <RequestMessageId>{64403E64-0FBA-429A-9431-41F4B5223949}</RequestMessageId>
  </Header>
  <Body>
    <MessageParts xmlns="http://schemas.microsoft.com/dynamics/2008/01/documents/Message" />
  </Body>
</Envelope>

The AX adapter will strip out the message envelope when the pass through property is set to false, and xml receive pipeline will try to parse the message body, which is empty. BizTalk cannot deal with empty messages and hence raises a warning.

Furthermore, because of the above error, the response message never gets consumed from the AIF Gateway Queue, keeping a permanent lock on the resource channel. Any other messages that are queued in the AIF Gateway Queue will failed to be consumed and you get the following errors logged on the BizTalk server:

"An X++ exception has occurred. Unable to lock resource channel '<ax channel name>'.". The source of the message is Microsoft Dynamics AX Business Connector.


We were able to workaround the issue so that the response message in the AX AIF Gateway queue does get consumed successfully by the BizTalk Adapter for AX (and hence release the resource channel lock), by implementing the following changes in our BizTalk solution: 

  • We consumed the whole message envelope instead of stripping out the xml envelope. The promoted properties are specified in the header section of the message within the envelope, hence consuming the whole message, will still allow the routing of the message within BizTalk when using the promoted properties.
  • Furthermore since you can only have one receive location communicating to one AOS server, and hence with the following changes to the BizTalk solution meant that you will always have to consume the full message including the envelope and message headers and not be able to just consume the message body:

(1) In the properties of the AX Adapter in the BizTalk receive location, Set the Pass Through property value to 'True'

(2) Create a new custom BizTalk receive pipeline, which contains the xml dissassembler pipeline component. In the properties of the pipeline component, set the Document Schemas (DocumentSpecNames) property to use the "DynamicsAX5.Message+Envelope, Microsoft.Dynamics.BizTalk.Adapter.Schemas, Version 5.0.0.0..." Schema. However DO NOT SPECIFY ANY schema for the Envelope Schemas (EnvelopeSpecNames) property, leave it blank, this is essential.

(3) Change all the receive shapes in the orchestration that receive messages from AX, such that the Message Type is set to DynamicsAX5.Message.Envelope schema.

(4) Where you are using correlation for the request/response of AX messages, the Correlation Type still needs to be set to DynamicsAx5.RequestMessageId to correlate asynchronous solicit/response messages correctly.

The above steps creates a subscription in BizTalk for where the message type is the DynamicsAX5.Message.Envelope and the BizTalk Adapter for AX consumes the message correctly (In this case it will be the whole message from AX including the envelope). Once the envelope is consumed, it will get routed to the orchestration instance based on the correlation setup on the RequestMessageId property. You can then use xpath statements to extract the message body or whatever data you need from the envelope.

For example, in my sample code to extract the response message I received after a succesful AIF Delete Action I did the following:

In my orchestration in BizTalk my response message gets assigned to a BizTalk Orchestration Message called SalesOrderDeleteResponseMsg. I created two variables called xmlResponseMsg of data type System.Xml.XmlDocument, and strResponse of data type string. I then used the following xpath statement in an Expression shape to extract the xml response message and assign it to xmlResponseMsg and then extract the content from the xml message and assign it to strResponse:

xmlResponseMsg = xpath(SalesOrderDeleteResponseMsg.ReturnValue,"/*[local-name()='Envelope' and namespace-uri()='http://schemas.microsoft.com/dynamics/2008/01/documents/Message']/*[local-name()='Body' and namespace-uri()='http://schemas.microsoft.com/dynamics/2008/01/documents/Message']/*[local-name()='MessageParts' and namespace-uri()='http://schemas.microsoft.com/dynamics/2008/01/documents/Message']");

strResponse= xmlResponseMsg.OuterXml;

NOTE: You will encounter a similar issue when using the Synchronous Adapter (by using the Solicit-Response port in an orchestration) and a workaround for this is detailed in the white paper: Microsoft Dynamics AX 2009 White Paper: Application Integration Framework (AIF) BizTalk Adapter Configuration for Data Exchange, Part II

How does the Export to Excel feature work under the hood?

One of the nice features of Dynamics AX 2009 is the Export to Excel that is available throughout the product and allows to content of a Grid to be exported to Microsoft Office Excel for further analysis. Sometimes however the feature does not work as expected. So for example Microsoft Office Excel is starting but the data from the Grid is not showing up.

The Export to Excel is not completely happening in the Dynamics AX Kernel but parts of the export logic are coded in X++:

  1. If you click at the button Export to Excel in any Form, the Dynamics AX Kernel is generating the list of data to be exported. The Dynamics AX Kernel takes here the formatted data as it is visible in the Grid.
     
  2. Next the Dynamics AX Kernel places this data in the Windows Clipboard, while the currently existing content of the Windows Clipboard is backed up.
     
  3. Then the Dynamics AX Kernel calls the X++ method performPushAndFormatting of the class SysGridExportToExcel. This method is instantiating Microsoft Office Excel using COM, pasting the data from the Windows Clipboard and applies some formatting to the inserted data.
     
  4. When the X++ part is finished the Dynamics AX Kernel places the original backed up content of the Windows Clipboard back.
     

The Windows Clipboard is playing a central role in the Export to Excel. Between the placing of the data in the Windows Clipboard and the retrieving of the data by Microsoft Office Excel several steps are happening. If for any reason the content of the Windows Clipboard is altered or replaced during this time the export will fail.

One cause of problems can be Add-Ins for Microsoft Office Excel. Add-Ins are loaded when Microsoft Office Excel starts and can manipulate the content of the Windows Clipboard before Dynamics AX had any chance to paste the content at a worksheet.

In order to find out what is happening during the export of data the Dynamics AX Debugger can be of a great help. Simply by putting a breakpoint at the beginning of the method performPushAndFormatting and checking the content of the Windows Clipboard while executing line after line.

Posted by EMEAAXTec | 0 Comments
Filed under: ,

How to fix SQL error: "Too many parameters were provided in this RPC request"

Recently we were confronted with a case where we received the following SQL error:

[Microsoft][SQL Native Client][SQL Server]The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Too many parameters were provided in this RPC request. The maximum is 2100.

This error occurs if we are running into a SQL limitation which does not allow more than 2100 parameters in a SQL statement.

Usually it's a Select statement where AX produces OR clauses with too many parameters like

WHERE RecId = xxxxxx OR RecId = xxxxxy OR RecId = xxxxyx ...

or IN clauses like

WHERE ID IN (xxxxxx,xxxxxy,xxxxyx, ...)

How to find where this select statements are comming from?
In the SQL statement trace log (Administration -> Inquiries - Tab 'Use') you will find the stack trace that shows you which method caused the SQL error.

How to fix this problem?
We have to add a forceliterals to the select statement in the relevant method.
Adding a forceliterals should avoid running into the SQL limitation of the 2100 parameters, because the statement is handled differently then.

The related statement could either be an X++ select stament or a X++ Query

X++ Stament

Change code from

select from TableName
to
select forceliterals from TableName

X++ Query

Activate forceliterals on the Query object

query.literals(true);
Posted by EMEAAXTec | 0 Comments
Filed under: , , ,

How to set the number sequence for Global Address Book when virtual companies are used

In global address book parameters a number sequence and a company must be selected to use for Global Address Book (GAB) entries.
In our scenario we have 70 companies. We do not have a single company which ALL users have access to, so it seems we cannot pick a company to use for the number sequence.
We also share the number sequence tables through a virtual company, across all 70 real companies.

The result is that we cannot configure Global Address Book. 

This is because users must have access to the company which is used for the Global Address Book number sequence, to be able to create new GAB entries.
Global address book parameters number sequence does not account for sharing of the number sequence tables out of the box.

So as standard it would be necessary to create a company to use for GAB which user's can access, and set up the number sequence in this company.
In this example as we are sharing the number sequence table (Tables\NumberSequenceTable), so we alreadey have a virtual company which everyone has access to with the number sequences in it, so we will need to change the X++ used to find the next DirPartyId so that it doesn't try and use a company specific number sequence.
I've given a code example for this change below, this is for Tables\DirPartyTable.getNewPartyId():

static DirPartyId getNewPartyId(boolean _throwError = true)
{
  NumberSequenceReference numberSequenceReference;
  DirParameters dirParameters;
  SysInfoAction_MenuFunction sysInfoAction = SysInfoAction_MenuFunction::newMenuItem(menuitemdisplaystr(DirParameters),MenuItemType::Display);
  NumberSeq numberSeq;
  DirPartyId partyId;
  dataAreaId numSeqCompanyId;
  container dataAreaIdList;
  ;
  dirParameters = DirParameters::find();
  numSeqCompanyId = dirParameters.NumSeqCompanyId;
  // START
  // changecompany (numSeqCompanyId)
  // {
  numberSequenceReference = DirParameters::numRefDirPartyId();
  if (numberSequenceReference)
  {
    numberSeq = NumberSeq::newGetNum(numberSequenceReference, false,true);
  }
  if (numberSeq)
  {
    partyId = numberSeq.num();
  }
  // } END
  if (!numberSeq && _throwError)
  {
    dataAreaIdList = [numSeqCompanyId];
    select firstonly crosscompany:dataAreaIdList dirParameters;
    sysInfoAction.parmCallerBuffer(dirParameters);
    throw error(strfmt("@SYS53911",fieldid2pname(tablenum(DirPartyTable),fieldnum(DirPartyTable,PartyId)),enum2str(NumberSeqModule::DIR)),'',sysInfoAction);
  }
  return partyId;
}

You will also need to make sure that the records you intend to use in Tables\NumberSequenceTable and Tables\NumberSequenceReference have the virtual company's ID associated with them and not one of the specific companies.
With this change it means that the value in numSeqCompanyId is no longer used so it doesn't matter what it is.

Posted by EMEAAXTec | 0 Comments
Filed under: , ,

License issue when customizing Gantt controls

When using Gantt charts from any module it works fine, but when trying to edit it from the AOT the following error occurs:
(e.g. when opening AOT/Forms/SmaDispatchBoard/Designs/Design/ and right click/edit)

The licensing has failed!
Please contact Netronic Software GmbH...

The reason for this is that the license for Gantt charts in Dynamics AX is only valid for runtime not development.

The guideline is that if you want to customize the Gantt control beyond using the available APIs, you should buy a development license from Netronic.
The statement from Netronic is that the development license is only needed for interactive or design time changes to the Gantt ActiveX control. It includes adding/editing the XGantt ActiveX control to the form as well, since it is being done at the design-time. However, if you are accessing XGantt ActiveX control in the run-time (through API) - e.g. using one of existing AX forms, then there is no need for the XGantt ActiveX development license, since you are not in the design-mode.
This applies to any AX layer (does not matter whether it is SYS or USR).

A good test could be to check whether you can do the same in Visual Studio - AX and Visual Studio development environments should work equally with XGantt ActiveX control.
You can also request a license file by

  • opening Forms/SmaDispatchBoard/Designs/Design
  • Right click - edit
  • AxtiveX/Properties
  • Click the lookup bottom of the Custom property.
  • When the XGantt properties open click the Licensing bottom.
  • Here you can click Request license information from Netronic.
Posted by EMEAAXTec | 0 Comments
Filed under: , ,
More Posts Next page »
 
Page view tracker