Sunday 7 April 2013

Query Dialog Fields Lookup in Classes in Ax 2012


Hi Friends,

Today we are going to do the query Lookup in dialog of classes because most of the clients would ask for this type of requirement.

Now we would place a customer Id lookup in the dialog. Declare QueryRun and Customer Id.
public void initParmDefault()
{
Query query;
;
super();
query = new Query();
query.addDataSource(tableNum(CustTable));
queryRun = new QueryRun(query);
}

public container pack()
{
;
return [#CurrentVersion, #CurrentList, queryRun.pack()];
}
public boolean unpack(container _packedClass)
{
Version version = runbase::getVersion(_packedClass);
Container packedQuery;
;
switch (version)
{
case #CurrentVersion:
[version, #CurrentList, packedQuery] = _packedClass;

if (packedQuery)
queryRun = new QueryRun(packedQuery);
break;

default:
return false;
}
return true;
}
public QueryRun queryRun()
{
;
return queryRun;
}
boolean showQueryValues()
{
;
return true;
}
By these above modification you can see Customer Id in the Query Dialog box.

Vivek Chirumamilla