Doens.be

  • Linkedin flickr twitter delicious Facebook Youtube

Archive for the ‘Ax 5.0 (2009)’ Category

How to make methods on fields disappear (aka a bug)

Me and some of my colleagues are currently working with a customer on a Ax 2009 SP1 RU4. The other day we came to the conclusion that the modified methods on fields in a form suddenly disappeared. I know, you should write as less as possible code on a form, but sometimes there is no way around this.

After some research we found a reproduction how these methods suddenly disappeared:

  1. Go tot the AOT and chose a form
  2. Open the [FORM] -> Data Sources -> [TABLE] -> Fields -> [A FIELD] -node
  3. Add a method (for example the modified-method)
  4. Save your form
  5. Go to the properties of the table in the datasource
  6. Place your cursor in the table property (properties window)
  7. Push ENTER

The result is that the table will be reloaded in the form and all methods you created on the fields will be gone. So here you have another reason why you shouldn’t write lots of code on your forms. You can only lose it by accident.

Enterprise Portal – titlebar issue (part 2)

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

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

  • click on a date picker (the date picker is shown)
  • click outside the date picker (the date picker is hidden)
  • finally, you re-click on the date picker

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.

System tables – part1

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.

  • AccessRightsList : This table is used to manage the authorization of the usergroups in Ax (Be carefull). The most important fields in this table are:
    • GroupId : Usergroup (UserGroupInfo)
    • RecordType : Type of accessRights Table, securityKey
    • Id : Internal Id of the object on witch access rights have been defined
    • AccessType: Granted access rights (No Access, Read, Change, Add, Full Control)
  • CompanyDomainList : This table contains relation between companies and domains.
  • Common : The is the table that describes all other tables. It conains some important fields that return in all other tables. For example RecId, TableId, CreatedDateTime, …
  • DataArea : This table contains data about created companies.
    Important fields:

    • Id : Company Id
    • Name
    • IsVirtual : Defines if the company is real (0) or Virtual (1). You often use this while looping trough companies with changecompany.
  • DataBaseLog : This table contains data about which tables and events to log.
  • DomainInfo : Table that contains info about the domains you have defined.

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

List of mandatory fields on a table

When you want a list of all the mandatory field on table X, yould check all the properties on the table fields, or you could be lazy and write a small job that does the trick for you. Just replace TableId with your tablenum.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
static void CheckMandatoryFieldsOnTable(Args _args)
{
    DictTable dictTable;
    DictField dictField;
    int i;
    TableId tableId = tablenum(custtable);
    ;
    dictTable = new DictTable(tableId);
    for (i=1 ; i<=dictTable.fieldCnt() ; i++)
    {
        dictField = new DictField(tableId, dictTable.fieldCnt2Id(i));
        if (dictField.mandatory())
        {
            info(dictField.name());
        }
    }
}

Microsoft Dynamics AX 2009 Development Cookbook

Just like my colleague Klaas Deforche, I am now reading the ‘Microsoft Dynamics Ax 2009 Development CookBook published by ‘Packt Publishing‘ that was published December 2009. It is a verry good book to look up a problem and find the correponding solution.

TOC:

  • Preface
  • Chapter 1: Processing Data
  • Chapter 2: Working with Forms
  • Chapter 3: Working with Data in Forms
  • Chapter 4: Building Lookups
  • Chapter 5: Processing Business Tasks
  • Chapter 6: Integration with Microsoft Office
  • Index

You can can by this book as a actual book or as a eBook. For more information / Buying / Code examples / Book preview of this book (Chapter 2) you can visit the PACKT-website.

Code Editor – shortcuts

Underneed you find the list of shortcuts I use most in Microsoft Dynamics Ax while developing.

  • General (shortcuts I also use outside AX)
    • CTRL + S : Save.
    • CTRL + C : Copy text to clipboard.
    • CTRL + X : Cut text to clipboard.
    • CTRL + V : Past text from clipboard.
    • CTRL + A : Select all.
    • CTRL + LEFT / RIGHT ARROW : Next/Previous word.
    • CTRL + SHIFT + LEFT / RIGHT ARROW : Select one word to the left/right.
    • CTRL + HOME / END : Go to begin/end of the editor.
    • SHIFT + HOME / END : Select text from the cursor to the start/end.
    • SHIFT + PAGE-UP / PAGE-DOWN : Select the previous/next page. of the line.
    • TAB / SHIFT + TAB : Indent Selection / Remove Indent Selection.
    • CTRL + BACKSPACE : Remove previous word.
    • CTRL + F : Find.
    • F3 : Find Next.
    • CTRL + Z / Y : Undo / Redo.
    • CTRL (+ SHIFT) + TAB : Next/Previous tab-page.
  • Ax specific
    • Current Line in the Code Editor
      • ALT + L : Select current line.
      • CTRL + L : Remove current line.
    • Breakpoints
      • F9 : Insert / Remove breakpoint.
      • SHIFT + F9 : Show all breakpoints.
      • CTRL +F9 : Enable / Disable breakpoint.
      • CTRL + SHIFT + F9 : Remove all breakpoints.
    • Compile / Run
      • F5 : run / execute current Job / Class / Form
      • CTRL + BREAK : Stop execution.
    • Lookup / More Info
      • CTRL + ALT + SPACE : Lookup label.
      • CTRL + SHIFT + SPACE : Lookup definition (go to the method).
      • CTRL + SPACE : Show syntax information.

And there are more shortcuts. You can find them on MSDN.

Working with numbersequences – On forms

When you want to implement NumberSequences in a Ax form (new numbersequence when you create a record etc.) you can just implement the ‘numberSeqFormHandler’.

Step-by-step: (more…)

Working with numbersequences – Keep In Mind

When you are using a Number Sequence, keep in mind that a Continuous Number Sequence is slower than a non-continuous. The reason is that the system creates a record in the table NumberSequenceList (with the status Active) and cleans it up later during TTSCOMMIT.

Performance tip: You can improve the performance of a process that creates many numbers of one Number Sequence by using number pre-allocation. This loads a set of numbers into the memory and provides faster access. You can do this by using the NumberSeqGlobal, witch means that once it is instantiated, it is available until the session is closed. This function is only available for non-continuous Number Sequences. The numbers can only be retrieved from the cache by calling the getNumInternal() method in the NumberSeq_Fast class.

Working with numbersequences – New Module

In a previous post I explained how to create a new Number Sequence in a existing module (Working with numbersequences – new NumberSequence). In this post I will explain how you can create a new Number Sequence-module.
I will create a new module called TEST (lack of inspiration).

Step-By-Step: (more…)