Best Practices – Technical Best Practices for Dynamics AX

June 28, 2010 No comment

While surfing on the web about Ax Best-Practices I found the following link on Packt Publishing. I think this is a verry good list of things a Ax developer should do while programming.

This article is a part of the book ‘Quality Assurance for Dynamics AX-Based ERP Solutions‘, maybe I’ll read it.

(more…)

Enterprise Portal – titlebar issue (part 2)

June 25, 2010 No comment

While I was checking my previous Enterprise Portal titlebar issue, me and my colleagues found a second bug. When you use a single quote () in the PageTitle, the name of the Page Defenition object is displayed instead of the actual label with the singel quote. We couldn’t find a solution yet, but we’re still looking.

Anyone any idea?

Enterprise Portal – strange behaviour with date-picker

June 18, 2010 No comment

Have you ever experienced the following symptoms in the Enterprise Portal:

Result: you see the message ‘Loading data’ and a ‘error on page’ message appears in the bottom of your browser.

When you open the error you will see a similar error:

Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)

Timestamp: Thu, 18 Jun 2010 06:00:00 UTC

Message: Sys.ArgumentNullException: Value cannot be null.

Parameter name: panelsDeleting[0]

Line: 4723

Char: 21

Code: 0

URI: http://dynamicsax/ScriptResource.axd?d=5kX_0LN0u7mwWn790LXsbY7Ctv1Hcwgr-zXRCNUAi2zkRoHYg1N1jlEUavJPzNwiZYTQiJ3dlxfzGp0UsvQxuKxp2przuGOLv2smzEfpZ-A1&t=ffffffff9b6540a0

Solution:
In the web.config file you will probably find a similar line: <compilation batch=”false” debug=”true“>. When you change the debug parameter to false (<compilation batch=”false” debug=”false“>) and execute a iisreset, this issue is solved. You will typically find this issue only in DEV-environments because debug should be turned off in a live environment.
Unfortunately Microsoft won’t create a Hotfix for Ax 2009 to solve this issue permanent. They ported the issue to Ax 6.0 and in the mean time we’ll have to use the work-around.

Smart projects

May 21, 2010 No comment

Every Ax developer tries to group their code from one defect or one analysis in one project. Sometimes you try to maintain the AOT structure in that project through groups (don’t forget to set the property projectGroupType). What some developers don’t know is that project-groups have a property GroupMask. Here you can fill in a prefix or part of a word and Ax will automaticly search through the AOT for objects that match this GroupMask. This system will also automaticly maintain itself.

Step-By-Step:
Go to your project and change the GroupMask property of a Group

Now when you save this and look at your project you will see the following:

Conclusion: Ax searches the AOT looking for all objects that matches the ‘projectGroupType’ and the ‘groupMask’.

Tip: When you set the GroupMask-property to ‘Tutorial’, Ax will look for all tutorials in the AOT. I have made a export of the project-structure, so you can have this output quicker. You can download this here.

Dialog Extended

May 12, 2010 No comment

One of my colleagues (Koen Dedecker) was looking for a way to prevent user interaction with other forms while a certain dialog is shown. After some research he found the solution on the blog Dynamics AX tools and tutorials from Vanya Kashperuk. A few years ago (2007) he made a simple extension of the dialog class that makes this possible. You can find more information and download some code samples on http://kashperuk.blogspot.com/2007/06/3-dialog-extensions.html.

The trick is actually simple:

Now when you make a new instance of the dialog class just set the value of the parmShowModal() to true. From now on this dialog will stay on top.

A few things you should know about temporary tables

May 10, 2010 2 comments

How do you set a table temporary:
  • You can set the property ‘temporary’ in the AOT to yes –> this table is always temporary
  • You can declare a buffer of a table and call the method setTemp() or setTempData(), from that moment on the buffer contains temporary data.
    CustTable custTable;
    ;
    custTable.setTmp();
    if (custTable.isTmp())
    {
        // Do something with your temporary table
    }
Things to know:

My opinion: Temporary tables are very useful and can help you to easily manipulate data you don’t need store permanently, but watch out where and how you use them.

The Ax Infolog

May 7, 2010 No comment

Wel all know the small dialog that gives the user usefull information about what is happening in Ax. In this post I will tell u some more about this.

You can add information to the Infolog by calling:


(more…)

System tables – part1

May 3, 2010 No comment

In this post I will talk about some Ax kernel tables that are automatically created after the setup at the first run of Ax. They are typically company independent (no DataAreaId) and contain some valuable information about AX.

You can find the tables I wil discuss under the AOT –> System Documentation –> Tables.

It is not easy to find info about these tables, but I hop this helps you all a bit.

Execute a job on data in several companies – part2

April 30, 2010 1 comment

In one of my previous posts I explained that you can switch company with the keyword changecompany. I also made a remark that you should set the value of your table-value to null after each changecompany.

Small code example (bad):

1
2
3
4
5
6
7
8
9
10
11
12
DataArea dataArea;
PurchTable purchTable;
;
while select dataArea
where !dataArea.isVirtual
{
    changecompany(dataArea.id)
    {
        select firstonly purchTable;
        info(strfmt("%1 (%2)", purchTable.purchId, purchTable.dataAreaId));
    }
}

The result is:

You can clearly see that the table variable is is known in the company you declared it.

Small code example (good):

1
2
3
4
5
6
7
8
9
10
11
12
13
DataArea dataArea;
PurchTable purchTable;
;
while select dataArea
where !dataArea.isVirtual
{
    changecompany(dataArea.id)
    {
        purchTable = null;
        select firstonly purchTable;
        info(strfmt("%1 (%2)", purchTable.purchId, purchTable.dataAreaId));
    }
}

The result:

So by making this small code change it runs perfectly.

NOTE: When you are calling a new method in the changecompany statement, you don’t have to set all the common variables that you declare  equal to ‘null’. This because they are declared after the companychange.

Crosscompany

April 30, 2010 No comment

Yesterday I talked about executing code/getting records in several companies. Now the changecompany is not the only method. You can also get data out of several companies by using the keyword crosscompany in your select statement.

Example:

1
2
3
4
5
6
7
8
9
Address     address;
container   conCompanies = [ 'cee', 'dat' ];
;
while select
crossCompany :conCompanies address
order by dataAreaId
{
    //Do something
}

« Previous PageNext Page »