Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dynamics ax 4.0, opening form without applying filter on current record

Tags:

axapta

I have form with VendTable grid for example, which has CustAccount field.

I want to place button, click on which will open CustTable form where all customers are visible.

If I just put CustTable menuitem, then clicking on it will open CustTable form, but in this form only one record is displayed - one that has the same AccountNum as in vendTable.CustAccount.

How to open whole custTable? Is there better solution than create button, and then use ClassFactory::FormRunOnClient to display form?

PS. I need button, so RMB->"Go to the Main Table Form" doesn't count.

like image 237
maykeye Avatar asked Aug 24 '09 03:08

maykeye


People also ask

Which user interface element is an inline pane that slides in from the left and contains multiple filter criteria that can be applied to the targeted content?

The Filter Pane is an inline pane that slides in from the left side of the screen and pushes the page content to the right, so that users can see the data that they want to filter. Users open this filter mechanism by clicking the system-defined Show filters button on the left side of the page.

How do you search in ax?

The search box is prominently displayed in the Microsoft Dynamics AX client, and you can view your recent search terms in the drop-down list. When you click the search icon, either in the Microsoft Dynamics AX client or Enterprise Portal for Microsoft Dynamics AX, the search results are displayed on a new page.


2 Answers

The problem is that the VendTable record is applied as an argument to the CustTable form, which then creates a dynalink. The solution is to avoid the argument.

Override the clicked method in the CustTable display menu item like this:

void clicked()
{
    this.menufunction().run(new Args(element));
}

This calls the CustTable form with the caller object only and without the record argument.

like image 111
Jan B. Kjeldsen Avatar answered Sep 18 '22 23:09

Jan B. Kjeldsen


I know this is a fairly old question but if someone comes here looking for the answer, just call method clearDynalinks() on the object QueryBuildDataSource.

For example, you have created a Form and it is automatically filtering your Datasource because of the Dynalinks that Dynamics creates automatically, you solve it by putting the following code inside the init() method, on your form Datasource:

QueryBuildDatasource qbds;
;


qbds = this.query().dataSourceTable(tablenum(MyTableName));
qbds.clearDynalinks();

// Next line is optional, it clears initial ranges
qbds.clearRanges();

// if you need to add any ranges you can do it right after you clear the initial dynalinks / ranges

Hope it helps...

like image 30
Smur Avatar answered Sep 20 '22 23:09

Smur