Replacement key in AX 2012

As we all know the default primary and cluster index in AX is the recid index. When we add a primary key based relation to a table we get a new column with the refrecid, an index for that column and a relation to the related table. There is nothing wrong with that. That is unless users want to change query ranges by pressing the select button of a runbase class or a developer adds ranges to that refrecid column. From that point the surrogate key is not your best friend anymore.

When a developer adds a range on a query of a column of type refrecID, the user is displayed a pull-down with the first column being the recid, besides the fields from the replacement key. The user then selects a 64 bit recid number as a query range. Next time the user opens the batch again, he has no idea what the purpose of this refrecid was.

However, if a user adds a range to the query by using the sysQuery form, he gets nice replacement keys. But sometimes he is not able to do this at all.

Example:

rp001

If there is a primary key based relation fields on the custtransopen table, the user cannot select them.

So let us explain how the SysQuery code works in case of replacement keys. The option replacement key column name is only there if the code below returns true. (code is part of the lookup method of the table fields in the sysQuery form.)

rp003

So, why these conditions?

The replacement key results in an additional inner join data source in your query. If the lower data source has a 1:1 fetch mode, the combination of the new data source and the lower data source acts like an ‘OR’ condition in your query while the user expects that it will work like an ‘AND’.

Therefore when user complains that they cannot add a range in a query, you know what to do. In the example of custcollectionlettercreate the custtrans has 1:n fetch mode.

What should the developer do in such a case? Well it is easy, he needs to simulate the process described above. Add the related data source with inner join relation and add the range on that table (the replacement key) .

Install enterprise portal on SharePoint 2013

It is an exciting day! Someone from MS Redmond (THANKS JARED, you are my  hero of the day!) told me to request KB2830441.

It is SharePoint 2013 integration. So I requested it like an ordinary Partner and slipstreamed it an AX 2012R2 Installation. Next I started a brand new Windows 2012 server (Hyper V), added it to our domain (4 Gb, 4 cores). And started installation. (slip stream)

EP001

Selected the EP role

EP002

Next this list appear, all with links that work, be aware the SharePoint download point to 2010 and the prerequisites to SharePoint 2013 CU. Her is the correct link for SharePoint 2013 foundation. http://www.microsoft.com/en-us/download/details.aspx?id=35488

Name

Description

Microsoft Report Viewer 2010 The Microsoft Report Viewer includes Windows Forms and ASP.NET  web server controls for viewing reports designed using Microsoft reporting  technology. This component is required in order to view reports, print list  pages, and print forms from the Microsoft Dynamics AX client.
Microsoft SharePoint Microsoft SharePoint Server is an integrated suite of server  capabilities that can help improve organizational effectiveness by providing  comprehensive content management and enterprise search. SharePoint Foundation  is the underlying infrastructure for SharePoint Server.
Website (Microsoft SharePoint Central Administration) The Microsoft SharePoint Central Administration web site must be  running.
Required updates for SharePoint 2013 To install Enterprise Portal updates to SharePoint 2013 are  required. These updates will be released by the SharePoint team when  SharePoint 2013 becomes generally available (GA).

When You install it, use the Complete role, otherwise local SQL instances will arise!

EP003

Also don’t run the post installation wizard when installing SharePoint 2013. First install the CU1. From that point run the post installation wizard.

EP004

After installing CU1, start the wizard manual, from here the steps are similar to a SharePoint 2010 installation. You can cancel the SharePoint farm configuration and continue on the Enterprise Portal. And we have a EP running. When starting the EP, you get this warning

EP006

But, when running an upgrade for the new SharePoint 2013 features we get this, the Enterprise site template is not compatible to SharePoint 2013.  You can ignore this, reason,  this patch gives no new Enterprise portal team. Perhaps in the next KB fix.

EP007

In case you want to create a new subsite. it is still 2010 experience

EP008

 

Microsoft Dynamics AX Diagnostic Framework (Beta) tool

Today I have installed the Microsoft Dynamics AX Diagnostic Framework (Beta) tool and I would like to share my first impressions with you.  In simple terms it is a type of windows service, with a database and a web client. When installing the next prerequisite will pop up.

image002

I had to struggle a little with the installation, especially to activate the correct IIS role. Log parser is downloadable from here.  The easiest way is to go about this is to deploy the dashboard in the same location as where your online help is running.

image004

image005

When opening the browser some easy configuration steps need to be followed.

The first step is to configure a first run:

image008

Once the first test run is complete, some handy advices appear:

image009

The checks are a series of AX and SQL installation best practices, more closely related to AX development best practice checks. The next screen dump shows results of my installation with Contoso data. Please note that I have run this without any customizations.

image012

When browsing through these issues, you will realise that this is default AX behaviour. It is known that there are DEL_ prefixed tables in the sys layer and that the table cache is not entirely correct on several tables.

Therefore this is a handy check for validating your installation and it also helps to pinpoint possible performance or stability issues.

Next we have some reports:

  • Environments
  • Resource intensive queries
  • Index lock contention
  • Indexes most accessed
  • Database IO performance
  • Database wait statistics
  • Missing indexes

These reports are however not new and compared to SQL Performance Dashboard reports , they are still limited. I do not understand why Microsoft have not reused these. Then we have Perfmon traces and SQL traces. I don’t know jet, if the perfmon traces can be analyzed like the PAL tool.

These are a new layer above existing tools which sounds rather promising. In fact they are a big step in the right direction. You can wave goodbye to the AXPerf tool and you no longer have to dive into the complicated world of SCOM. I also hope they will discontinue this type of logging on the IDMF tool. IDMF should stick to archiving and nothing more.

The question is do we have a tool that a customer or functional consultant will understand? The answer is NO. Let me give an example, why do we have an oil level indicator on the dashboard of our car? Simple, it is there to warn us that we should take action otherwise the car might break down. The first thing you do is to read the manual and, if you are unable to solve the problem yourself, you refer to your car mechanic. So it is easy for a car, why cannot it be just as easy for Dynamics AX?

This question has been on my mind for the past 4 years. Therefore I have created my own solution Performance Dashboard. All the information is in AX and a customer can easily monitor whether everything is fine or if he should start getting worried.  The dashboard display shows the highest, lowest and average scores and also uses cues to jump straight to issues.

image014

It also provides an overview for the day and you can also compare days. This is helpful as issues have the habit of manifesting themselves when you are not at the customer side.

image016

This dashboard can even warn you by sending alerts or daily reports. I receive a mail every day containing an overview of the current status. These reports show me trends

image018

It also can run best practice checks for performance issues on your tables.

image020

The only limitation of the tool is that it cannot send an email or Alert when the AOS is down. After all though, the purpose of such a monitoring tool is to anticipate problems and avoid downtime.

More information links.

http://technet.microsoft.com/en-us/library/jj884461.aspx

http://www.axstart.com/products/performance-dashboard/

http://www.youtube.com/watch?v=k3bPUAHvlZ0

 

Best practice checks.

When checking my Ax code, I always use best practice checks. Most of the time I perform this during the last 10 minutes of the day. I do not use compiler level 4 but I have to admit this has some issues.

Most of these issues make sense, but some of them are contradictory or cannot be solved because the core AX framework is programmed the wrong way.

My preference is to start with these settings.

1

 

From this point it is up to you what checks can be skipped. Skipping means not to comply with http://www.microsoft.com/dynamics/en/gulf/partners-certified.aspx

But, in case you do not wish to follow this direction, I could give some tips so the imported checks stay on

-        Labels

  • Turn off help labels, in most projects I review they are not used altogether.
  • Use of Labels: if you use single quotes instead of double quotes the warnings disappear.
  • Use the description {locked} on labels from the developer documentation on tables.

-        AXBc Fields on tables: You can ignore this unless you are using the fields in AIF.

-        XML documentation: I know this is a lot of work but did you know that the remark section is optional? See http://msdn.microsoft.com/en-us/library/cc593549.aspx

-        “Customizing this class may cause problems with future upgrades to the software.” warning

/// <remarks>
/// This is a   framework class. Customizing this class may cause problems with future   upgrades to the software.
/// </remarks>

4

Ok, so far so good, now it is time for the freak show:

-        Reports

  • New should be protected. If you do this your report will not run anymore…..

-        The Construct method must only instantiate the class. Consider using a static new pattern instead.

  • I have just extended a class from the sys layer which does not follow this best practice, therefore it is a design issue for MS….

-        Forms

  • Listpage interaction classes: Implement static construct to allow for modifications. It will never be used…
  • My parameter form uses data that is partition independent, so the table is of type Framework: You will get all kinds of warnings of wrong captions in the parameter form.
  • An Action Pane should not be present on a form that is not a list page or other content page. This is an outdated warning, only relevant to AX 2009!
    2
  • A document handler button on an Action Pane should use the label @SYS114630 for its Text property. The code seemed to be targeting the name property and the text property separately  but the check however seems to be asking for two different text property values, which is obviously impossible.
    3

At the end I am still not happy with it: there are other checks such as broken relations, editable primary indexes, obsolete code and missing labels (this can happen when you use TFS, check in the EDT first and next check in the label, the label on the EDT is not corrected).