The editor in Axapta is as easy to extend as the rest environment. If you check the class EditorScripts, you see a list of methods which is standard. In this example we add a little script which marks your inputed extra code. We always mark all added or changed code, to make it easier to see afterwards what’s added and what’s standard. By doing this it is also makes it very easy to search for all code related to a certain project. This code is an example of what we all use several times a day.
Continue reading How to extend your editor in Axapta
Category Archives: Dynamics AX 4.0
How to add a timer to the SalesTable form
When you want a grid in a form to be updated on a regular basis (so your users always see latest information), you need to add a timer to your form. You need two things. A timer method and a initial call to it when the form starts.
Continue reading How to add a timer to the SalesTable form
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
How to read the Data Dictionary in Axapta
This little script creates an Excel .CSV (text) file of complete Data
Dictionary of current Axapta environment. Handy when you need
to have a collected list of all tables and there fields with types etc.
Continue reading How to read the Data Dictionary in Axapta
Class InventOnhand
The class inventOnhand is very useful when retrieving inventory information for a specific item.
If we want to get the sum of an item for all warehouses and all configurations:
Continue reading Class InventOnhand
How to traverse a directory in Axapta
This example list all files in a directory including sub-directories. Handy when you need to do something with a number of files stored in a structure of folders. Here we lists all the text files it can find, you only need to alter the FO_ProcessFile() method for your needs.
Continue reading How to traverse a directory in Axapta
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); } |