Search code examples
formsaxaptalookupdynamics-ax-2012x++

How to make invisible the lookup field?


I want to take a value from lookup field. But I neet to make invisible this field. My code is this:

public void lookup()
{    
    Query query = new Query();
    QueryBuildDataSource queryBuildDataSource;
    QueryBuildRange queryBuildRange;    
    SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(MYTable), this);    
    sysTableLookup.addLookupField(fieldNum(MYTable, FieldTableA));
    sysTableLookup.addLookupField(fieldNum(MYTable, FieldTableB));
    sysTableLookup.addLookupField(fieldNum(MYTable, RecId), true);    
    queryBuildDataSource = query.addDataSource(tableNum(MYTable));    
    sysTableLookup.parmQuery(query);    
    sysTableLookup.performFormLookup();
}

So, I need to populate the field with RecID, but I don't want to see the RecId in my lookup.

It's possible?

Or, another question, It's possible to get two value for the same record, in my case to get the values from MyTable.FieldTableA and Mytable.FieldTableB?


Solution

  • No this is not possible with the standard lookup as far as I can tell. You can see how it builds the dynamic lookup form here:

    \Classes\SysTableLookupBase\buildGrid

    You can make your own custom lookup form.