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

3

7

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.

Weinstock answered 24/8, 2009 at 3:53 Comment(0)
C
6

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.

Canadian answered 26/8, 2009 at 9:28 Comment(0)
G
4

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...

Grazing answered 30/11, 2011 at 17:8 Comment(0)
A
0

You have 2 options, you can either create a button and override its clicked() method, or use a MenuItemButton and assign an Action MenuItem to it.

Using MenuItems is a best practice, because it allows you to use the AX security & configuration framework. You can associate a class to the MenuItem and in the class' main() method you can run the FormRunOnClient() stuff as needed.

Aimless answered 25/8, 2009 at 9:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.