Adding a colour picker lookup to an AX form

Here’s a quick and easy way to add a colour picker lookup to an AX form.

I’ve seen a number of different ways to add colour picker support to an AX form, but so far, this has been the easiest.  It is not ideal, because the colour picker opens up as a dialog window, something which can’t be easily worked around without resorting to using custom ActiveX or .NET controls.

Continue reading “Adding a colour picker lookup to an AX form”

Filtered form reference group lookup

Dynamics AX 2012 introduces built-in support for resolving and looking up linked records based on reference record IDs.

When adding a reference record ID field to a form, AX will add a reference group control instead of the reference record ID, and will show a selected set of fields from the referenced table.  See the posts about tree lookups for an example.

The reference group control also does lookups into the referenced table for selecting a new value.  However, by default this lookup is not filtered and will show all records in the referenced table.  Adding filtering is quite easy to do and it follows a similar pattern as regular table lookups.

Continue reading “Filtered form reference group lookup”

toolTipField() method not working

According to best practices, data-related code that accesses data from the database or otherwise would benefit multiple forms should be placed on the table.  Examples of this are display methods, validations and business logic to be executed on inserts, updates, deletes.

It would be logical to think tool tips would be included as well, and there is a record method called toolTipField() which can be overridden in your table.

Only problem is, it’s not working.  (At least not in 2012R3)  The code doesn’t even get called.

To work around it, add the tool tip code directly to your forms instead.  Not best practice according to the book, but what works will always trump what doesn’t…

Dynamics AX error: The fetch type refresh cannot be used with forward only cursors

I recently encountered a strange error in AX, where on opening a particular form, AX would throw an error saying “The fetch type refresh cannot be used with forward only cursors”.

Restarting the AOS, running full X++ recompile and full CIL generation did not resolve the problem.

“The fetch type refresh cannot be used with forward only cursors”

Continue reading “Dynamics AX error: The fetch type refresh cannot be used with forward only cursors”

Too many joins in query

In Dynamics AX 2012, if you are running a query with too many joins you can get an error or warning message saying “The number of joins in the statement is XX.  This exceeds the maximum of 26.  Turn on exception for this warning to see the call stack.”

So what is this, and what can you do about it?

Continue reading “Too many joins in query”