Category Archives: Development

Posts about development in Dynamics AX 4.0 or Axapta 3.0

SysInfoAction

Found this blog entry made by Kamal. The entry explains how to use the SysInfoAction classes. I played around with this classes and found out that you can get pretty specific when referring the user to the source of the info message.

This is a simple job that produces an info box that gives the user the option to open a form and edit a specific field on a specific record:
Continue reading SysInfoAction

Copy data between companies

I have recently done some modifications that required certain data that was very time demanding to enter manually in Dynamics Ax. This data was also needed in a number of different companies which meant that I had to enter this data several times.

Because I’m against all that is time consuming I created a script that only require that I enter my data once and then lets me copy this data to the other companies.
Continue reading Copy data between companies

Using CacheAddMethod

When working in forms and using display methods, sometimes they have a tendency to slow down the form to the degree that makes you wonder if it’s worth it at all. This is when cacheAddMethod comes in handy.

When using cacheAddMethod we place the method in memory, the effect of this is that the method only runs once when the form loads and then every time we switch between records. This instead of display methods normal behavior, which means it runs every time all the time.

For the cacheAddMethod to do what it’s supposed to we need it to run when the form starts up. If we have created the display method “OurTestMethod” on table SalesTable we want to place the call to cacheAddMethod in the init method on the form datasource SalesTable.
Continue reading Using CacheAddMethod

resAppl macro when using images

Using images in Dynamics AX can sometimes be a painful experience, just keeping track of the Integer that represents the images is almost impossible. But with a macro called resAppl this becomes much easier, mainly because you, most of the time, can guess what commands to use to get the image you want. This makes it easier to remember between times you are going to use it, and above all it makes your code much easier to read and follow.
Continue reading resAppl macro when using images

Find files in a file directory

If you want to open or read files in a file directory you can use the following example to find the filenames.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
  static void showFileName(Args _args)
  {
      int           handle;
      FilePath      filePath;
      FileName      FileName;
      ;
 
      filepath = "c:\\windows";
 
      [handle,filename] = 
       WinAPI::findFirstFile(filepath + "\\*.*");
 
      while (filename != "")
      {
          info(filepath + "\\" + filename);
          filename = WinAPI::findNextFile(handle);
      }
 
      WinAPI::findClose(handle);
  }

Intercompany with buf2buf

When discussing the “Basics of changecompany” we copied table records from one company to another through X++ code. Using buf2buf makes this is a lot easier.

Buf2buf is used to copy one recordbuffer to another:

       buf2buf(Common _from, Common _to)

If we apply this to the code we used in “Basics of changecompany” we get:
Continue reading Intercompany with buf2buf