How to filter a record in ProjTable form in AX 2009?

Hi all,

I have a small doubt about displaying only a selected record in ProjTable form.

new MenuFunction(MenuItemDisplayStr(CustTable),MenuItemType::Display).run(args);

When a write the above code to display or open the form, CustTable form opens by displaying only CUS00009 details.

But when i do the same thing for ProjTable form, the ProjTable form doesnt open with a particular record selected and hence simply opens the form normally by displaying all the records present in it. I just dont understand why is it happening?

Can anybody please help me on this? I wrote the following code to open ProjTable form by selecting only a particular record

new MenuFunction(MenuItemDisplayStr(ProjTableMain),MenuItemType::Display).run(args);

but this code is not opening the form by just selecting that record. ProjTable form is simply opening as usual

Thanks & regards



I looked at the from ProjTable and apparently you need to specify in the arguments a form open mode for example edit, like this:


But that code would have to be called from a form whose dataSource is ProjTable, and it won´t filter the records it will just positionate you in the record, specifically in the form Tab General

So I think the easiest way to filter it would be to add code in the executeQuery method of the ProjTable datasource, try this:

Declare ProjTable myProjTable;

And call the following code before calling super():

if(element.args() && element.args().dataset() == tablenum(ProjTable))

myProjTable = element.args().record();
ProjTable_ds.query().dataSourceTable(tablenum(ProjTable)).addRange(fieldnum(ProjTable, ProjId)).value(myProjTable.ProjId);


**Additionally you can add an enum parameter when you call the form and a condition in the filter, to apply the filter just when you call it.

Best Regards,

Manuel Esquivel


// open Projects form

args.refField(fieldnum(ProjTable,ProjId)); <-------- Adding this line worked for me


new MenuFunction(menuitemdisplaystr(ProjTable), MenuItemType::Display).run(args);



if you want to open the projtable form for a specific customer account…

projtable_ds.query().dataSourceTable(tablenum(projtable)).addRange(fieldnum(projtable, custaccount)).value(“2001”);

if you want to open the projtable form for a specific project id…

projtable_ds.query().dataSourceTable(tablenum(projtable)).addRange(fieldnum(projtable, projid)).value(“proj-000001”);

write this method in init() method after super in projtable form…

or write in the projtable datasource executequery() method in projtable form…