Thursday, July 26, 2012

AX Enterprise Portal 2012 - Modify AxGridView lookup

If you want to filter or modify visualized fields on a Lookup inside an Axgridview, here is how you can do it:

Add this method to the field you want to change your lookup, in your ax Dataset. (the method is not listed in the override methods)

 void void dataSetLookup(SysDataSetLookup sysDataSetLookup)
{
    Query q = new Query();
    List list = new List(Types::String);
 
    list.addEnd(fieldStr(InventTable, ItemId));
    list.addEnd(fieldStr(InventTable , NameAlias));
 
    q.addDataSource(tableNum( InventTable ));
    q.dataSourceNo(1).addRange(fieldNum( InventTable , ItemId)).value('000001');
     
    sysDataSetLookup.parmQuery(q);
 
    sysDataSetLookup.parmLookupFields(list);        
}


No comments: