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

  • August 5, 2010
  • 4 Comments

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 … Continue Reading

Expressions in query ranges – limitations

  • April 9, 2010
  • 2 Comments

When you want to construct a query-object that contains OR-conditions, you can construct something like this: 1 2 3 4 5 6 queryBuildRange.value(strFmt('((%1 == %2) || ((%1 == %3) && (%4 == "%5")))’, fieldStr(InventTable, ItemType), any2int(ItemType::Service), any2int(ItemType::Item), fieldStr(InventTable, ProjCategoryId), queryValue("Spares")));queryBuildRange.value(strFmt(‘((%1 == %2) || ((%1 == %3) && (%4 == "%5")))’, fieldStr(InventTable, ItemType), any2int(ItemType::Service), any2int(ItemType::Item), fieldStr(InventTable, … Continue Reading

Setting propperties on a FormControl without AutoDeclaration

  • March 19, 2010
  • 2 Comments

When you want to set a property of a control on a form without setting the property AutoDeclaration = yes. You can address the control trough the following code, knowing that element is a FormRun-object: element.design().controlName("btnOk").visible(false);element.design().controlName("btnOk").visible(false);

Catching a key-press

  • March 10, 2010
  • 1 Comment

When you want to catch a key-stroke on a form, you can override the method task() The default method will look like this: public int task(int _taskId) { int ret; ret = super(_taskId); // write you’re code here return ret; }public int task(int _taskId) { int ret; ret = super(_taskId); // write you’re code here … Continue Reading

Counting the number of records in a QueryRun

  • March 9, 2010
  • 0 Comments

When you want to count the number of records that are currently displayed on a form, and you have only one data source, just call the static method countTotal() from the SysQuery-class. public void executeQuery() { ; super(); info(int2str(SysQuery::countTotal(EmplTable_ds.queryRun()))); }public void executeQuery() { ; super(); info(int2str(SysQuery::countTotal(EmplTable_ds.queryRun()))); } But when you want to do the same … Continue Reading

Working with numbersequences – On forms

  • February 18, 2010
  • 0 Comments

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:

Line Number

  • February 13, 2010
  • 0 Comments

When you want to create a table were you want to remain the position of the records you create (like the lineNum field on the SalesLine), you just need to define a field on your new table as a ‘CounterField‘. Step-by-step:

Lock on form elements in Dynamics Ax

  • November 4, 2009
  • 0 Comments

Some end-users like to make their own modifications on their forms (right-click on the form –> setup). Last week I had a customer that was not able to do this trick any more. After some research and a tip from a colleague, I came to the conclusion that this had something to do with overriding … Continue Reading