Auto search on form data source

Following scenario: You are creating a new form in AX2012. You are adding a form data source, for example the ProdTable, inserting some fields to the interface. But you don’t want the form to show always the first dataset of the ProdTable on your form fields. In that case you can set the property “AutoSearch” to “no” on the form data source.

It can be useful if you add a specific StringEdit field to the form, extend it with the ProdId EDT and add the modify method to the field. Extend the method as following:

ProdTable_DS.query().dataSourceTable(tableNum(ProdTable)).addRange(fieldNum(ProdTable, ProdId)).value(queryValue(this.text());
ProdTable_DS.executeQuery();

Everytime you modify your ProdId string field, the ProdTable will be selected to your form.

Leave a Comment