We have a customized field in AX that we want the user to be able to select multiple records and change them all to the same value at once. Dynamics AX 2009 has a fill utility that can do this. However, the fill utility can only be used on tables that are "main" tables (property TableGroup = main). I wanted it to be able to be used on my custom field (a date field) on the SalesTable form. Here's what I had to do:
On the Form: SysRecordInfo, Method: init
Add code to allow the fill utility to be used on my table.
void init()
{
....
// don't do the field level testing if the table doesn't meet the base requirement
if (dictTable.tableGroup() == TableGroup::Main ||
common.TableId == tablenum(LedgerJournalTrans)
//N - GW_Admin_FillUtility - Arains 03/02/2012
// Allow the fill utility to be used on the SalesTable
|| common.TableId == tablenum(SalesTable))
{
element.fillUtilityInit();
}
else
{
fillGrp.visible(false);
}
....
}
Also, on the Method: fillUtilityInit
Add code to allow the fillUtility to be used for my custom field on the salestable and only my custom field on the SalesTable.
void fillUtilityInit()
{
....
if (fieldIdLocal == dictTableLocal.primaryKeyField() ||
fieldIdLocal == dictTableLocal.fieldName2Id('RECID') ||
fieldIdLocal == dictTableLocal.fieldName2Id('DATAAREAID'))
{
fillGrp.visible(false);
return;
}
// New code for fill utility modifications
// If this is the salesTable and this is the custom date field
// allow the fill utility to be used, disallows for all other fields
if(tblId == TableNum(SalesTable) &&
fieldIDLocal != dictTableLocal.fieldName2Id('YourCustomField'))
{
fillGrp.visible(false);
return;
}
....
}