Thursday, August 28, 2014

My new best friend: Set-AXModelStore -InstallMode

I'm working on an upgrade from AX 2012 R2 to AX 2012 R3, and during the initial work upgrading the code I experience from time to time that the client crashes. To be fair we probably have modifications in places we shouldn't have them, though I have removed the worst before starting the upgrade.

The problem is that when I restart the client, I get an empty workspace and the menu item to open a new development workspace is disabled.

Panic sets in and my pulse rate gets alarming high, but...

Manually setting the model store in installation mode again and restarting the client opens the "The model store has been modified" dialog and I'm able to open a development workspace again.

So if that happens to you, try to open the Microsoft Dynamics AX 2012 Management Shell and enter the command "Set-AXModelStore -InstallMode".

Tuesday, August 26, 2014

Dynamics AX learning paths

Here is a really cool document i found on a danish Microsoft site. It gives you a good overview of AX training for whatever role you are in.

Download it here from my OneDrive.

Tuesday, August 19, 2014

Spelling errors in Office Add-In can cause wrong value substitution in table columns in R2

When you create a Word template with the Office Add-In and Word for some reason marks field names  in your columns as being misspelled, these columns aren't getting their names properly replaced with actual values when you merge the template into a document with values.

You can reproduce the problem by going through the following steps on for example a standard AX 2012 R2 demo machine.
  1. Make sure your AX user is setup to run en-us as language.
  2. Make sure that you in Word have at least one other proofing language than en-us installed.
  3. Make sure that Word uses en-us as the default proofing language.
  4. Go to Organization administration / Setup / Document Management / Documents data sources.
  5. Add the SalesLine query and activate it.
  6. Open Word.
  7. Add some text in top of the document, just to make some space to the table you are about to insert.
  8. Insert a table with two rows and five columns.
  9. Go to the Dynamics AX tab and click Add Data.
  10. Select the data source you started out setting up.
  11. Add the following fields.
    • Sales order
    • Item number
    • Quantity (ordered quantity)
    • Unit price
    • Net amount
  12. Save the document and run a Merge.
  13. That should look ok.
  14. Go back to the template, select all with Ctrl-A and change the proofing language to something other than en-us.
  15. Run a spell-check and check that it finds supposed spelling errors in your column names.
  16. Save the document and do a new Merge.
  17. Now things don't look alright.
Some screenshots:
The template

The first well done merge

The template with the new proofing language and after spell check
The not so well done merge

There are some workarounds:

  1. Keep you fields names to just one word.
  2. Run a spell-check of the template and choose to ignore all spelling errors in fields names, making the squiggly lines disappear.
  3. Use a speciel Word style, which set up to not being checked for spelling errors, for the fields.
  4. Sometimes just shortening the name of the field in the table helps; for example from "Item number" to just "Item".
Well, it is an odd issue. But now you know a probable cause if you run into it.

For some KB2904824 should fix the issue. I havn't had any luck on my systems though.
I can't reproduce the issue in R3, so it must be fair to assume that is has been fixed for R3.

Thursday, August 7, 2014

Check the SQL statement generated from a regular X++ select statement

So here is another small tip based on me reading Inside Microsoft Dynamics AX 2012 R3.

If you want to know what SQL statement the SQL Server query processor generates based on a regular X++ select statement, you can add to the keyword generateOnly to the statement and afterwards call the getSQLStatement method on the record buffer.

   AccountingEvent         accountingEvent;
   SourceDocumentHeader    sourceDocumentHeader;
   select generateonly accountingEvent
   join sourceDocumentHeader 
       where sourceDocumentHeader.RecId == accountingEvent.SourceDocumentHeader;

   info (accountingEvent.getSQLStatement());

That turns out something like this:

Friday, August 1, 2014

Use the Filter tab of the Find dialog

I have started to read Inside Microsoft Dynamics AX 2012 R3 and I read it from cover to cover. Sometimes you get reminded of great but forgotten features when doing so.

This time I was reminded of the Filter tab of the Find dialog. With this filter you can create any kind of boolean function to control what the tool returns of findings.

Here is a small example you can use to find methods with more that 50 lines:

Here I have used it on the SalesFormLetter class.