Archive for the ‘Dynamics AX 4.0’ Category

Create class and methods in x++

Monday, December 22nd, 2008

This job does three things.

1. Creates a new class, compiles and saves it.

2. Finds the class and adds a new static method to it.

3. Calls the new method using DictClass.

(more…)

Simple field lookup in form

Monday, October 13th, 2008

This is a simple way to add a custom form lookup to a new field with x++ code. This example is done with a test table named FO_TestTable that has the three fields “TestField1″, “TestField2″ and “TestField3″. The table FO_TestTable has an index named “TestIdx”.

I have added a field on the table CustTable named TestField1. On this field that now can be found on CustTable form on the CustTable datasource node, I have added the “Override method” “lookup”.

Below you can see how I have edited the method lookup to fit my needs. Notice that the sysTableLookup is based on an ordinary query, this means that you can manipulate this query as you see fit.

(more…)

Get your Intercompany CustAccount

Monday, September 29th, 2008

Ever wonder if there is an easy way to find out what customer account a sales company has at the production company?

This might not be an easy way, but it is one way to do it:

(more…)

Sorting containers with multiple levels

Monday, September 22nd, 2008

I encountered a scenario where I wanted to find a record of a certain type somewhere in a big container. This got med thinking, and the result is the code below. I wanted to be able to loop through a container no matter how big it was or how many levels of new containers it contained.

This job searches through the container con1 and sorts the types Integer, Real and String into separate containers. In itself this job might not be very useful, but my goal was to build something that could easily be modified to work in many different cases when looking for different values in containers.

It also finds the specific records of VendTable, CustTable and SalesTable that I hid inside the container structure.
(more…)

A quick look at lists and a bit of XML

Friday, September 5th, 2008

This is just a quick look at the List object in Dynamics AX. Just played around with it to see what functionality was there and what wasn’t. As you can see I just created a simple list of integers and also one with records from InventTable, if you wan’t to know what types can be placed in the list, check out the baseEnum “Types” in the AOT.

As a bonus I also created a xml file of the list of integers.

(more…)

Inside Dynamics AX 4.0 - Free eBook

Wednesday, May 21st, 2008

Found this on the blog mfp:s two cents. You can now download Inside Dynamics AX 4.0 for free as an eBook provided by Microsoft.

Link to blog post.

Nice to also have an portable and searchable version to add to my copy of the paperback.

How to add current profile name to the window title

Wednesday, May 21st, 2008

If you use a descriptive text on your profiles you use to startup axapta with, you have here another way of a very clear presentation of which installation, db, etc settings you are running under.
(more…)

How to colour code different companies inside axapta

Wednesday, May 21st, 2008

During development and test we often switch between different companies in our installation. To not mistaken us, so we always make changes in the correct one, we made this small change in the code. With different background-colours for each company, you never delete something importent by mistake. This example shows how it could be done.
(more…)

How to catch special keystrokes and use them as shortcuts

Wednesday, May 21st, 2008

Rightclick on a form and go down tracking a specific field or other data, is a tedious work if you do it dozens of times per day.

We wanted to catch the key combination ctrl+Z (since it is rarelly used when running axapta), so we could use it to display common data about a form, field or other info. This is a code example we nowdays always install in all new test and development environments (not production, since it would give normal users unwanted access).
(more…)

How to clock routines which (should) go faster than 1 sec

Friday, March 28th, 2008

From the basic routines in Axapta we only have the TimeNow() function which returns number of seconds since midnight. To measure something more exact than that, we either need to do an API call to getTickCount or to use the setTimeOut() function. This is a small demo on how to implement both such timers.
(more…)