·
2 min read

2. Solving Fill Utility errors on Microsoft Dynamics AX 2012 – Fill Utility incorrectly updates a field that is not in the field list of the main datasource

The following applies when using the fill utility in a form to change a field that is not the main data source of the form data in Microsoft Dynamics AX 2009 or 2012

Scenario:
A user wishes to update the cost price for an inventory item. Using the fill utility they select the appropriate field to update and follow the steps to use the fill utility. After completing the process the user finds that the cost price information did not change but the Item type for the item was updated.

 

What happened?
The fill utility uses a field list to determine the field to update. In the case of secondary data sources the fill utility is not able to decipher the difference in the table being updated. In the case here, the cost price is field 3 in the InventTableModule. When the update takes place the 3rd field in the InventTable, Item Type, is being updated.

 

What we did to prevent this from happening?
One way to prevent this would be to make the Fill Utility button from being visible when the user wants to update a field that belongs to a secondary data source of a form.

Here is sample code snippet that demonstrates this:

\forms\SysRecordInfo\fillUtilityinit

object = formControl;
fldId = object.dataField();
fds = callerForm.dataSource(getDataSourceNo(object.dataSource()));
tblId = fds.table();
// Code added to hide the Fill Utility button when the
// selected field is from a table that is not the main table of a form.
if (fds.joinSource() != 0)
{
fillGrp.visible(false);
return;
}
//End change

Disclaimer:
This programming example is for illustration purposes only. Microsoft disclaims all warranties and conditions with regard to use of the programming example for other purposes. Microsoft shall not, at any time, be liable for any special, direct, indirect or consequential damages, whether in an action of contract, negligence or other action arising out of or in connection with the use or performance of the programming example. Nothing herein should be construed as constituting any kind of warranty.

 

Other related articles:

1. Solving Fill Utility errors on Microsoft Dynamics AX 2012 – SysDictFieldGroup object not initialized

3. Solving Fill Utility errors on Microsoft Dynamics AX 2012 – Error executing code: Wrong argument types for comparison

4. Solving Fill Utility errors on Microsoft Dynamics AX 2012 – Error executing code: Wrong argument types for comparison (another scenario)

 

 

–author: Erco van Harn
–reviewer: Mansour Yahya Mohamad Mansour