How to use MenuFunction PriceDiscTable_PriceSalesAction

Hi, All

I am new with Dynamics AX. My question is How can I filter only PriceDiscTable.ItemRelation == ‘QHK010R’ on PriceDiscTable Table when I click button to open PriceDiscTable Form

There is my code on button click.

void clicked()
{
Args args;
Object salesTableForm;
MenuFunction menuFunction;
PriceDiscTable _PriceDiscTable;
;
select firstOnly * from _PriceDiscTable
where _PriceDiscTable.ItemRelation == ‘QHK010R’;

Args = new Args();
args.record(_PriceDiscTable);
salesTableForm = new MenuFunction(menuItemDisplayStr(PriceDiscTable_PriceSalesAction), MenuItemType::Display).create(args);
salesTableForm.init();
//salesTableForm.toggelSimpleAdvanced(false);
salesTableForm.run();

super();
}

This code open form correctly but it show all record in PricediscTable Table Why?

Please help me, Thanks in advance.

The form might have its own filtering criteria’s(which can override yours). try to debug and see