When playing with some X++ code, I found an interesting addition that happened in AX 2012 related to form development.
There are 2 new methods that were added to the FormDataSource class, which allow you to very easily and error-free access the underlying QueryBuildDataSource, whether that is for the initial form query or for the queryRun that also contains user filters and sorting.
So, for example, instead of writing:
this.query().dataSourceTable(tableNum(InventTableModule), 2);
this.queryRun().query().dataSourceName(identifierStr(Purch));
....
you can use the 2 new methods:
this.queryBuildDataSource();
this.queryRunQueryBuildDataSource();
It might seem as a very minor improvement, but in reality it greatly simplifies maintenance of code on forms, when new datasources are added or existing ones removed/renamed.
That's all for today.
Showing posts with label QueryBuild. Show all posts
Showing posts with label QueryBuild. Show all posts
Monday, October 24, 2011
Thursday, April 22, 2010
Tool: User preferred startup menu for Dynamics AX 2009
In AX 2009, the user has no control over which menu is opened in the navigation pane and address bar when AX client is started.
Most of the time you simply get the Home page, which is frustrating for a number of users. Another thing that is frustrating for them is the company account the application opens with.
The latter can actually be setup using standard application functionality in the User options form. Just set the 'Start company accounts' to the account you want for the user by default.
I wrote a small tool, that allows the user to select a preferred startup menu, ensuring that this menu is the one open every time AX client is started. Something similar existed in Axapta 3.0 application.
You can download the xpo for this tool from my SkyDrive.
Note, that it contains minor changes to a number of existing application objects.
I suggest that you compare the xpo from the import dialog and ensure that you don't override any of your changes during import - the best thing would be to re-implement these minor changes manually. Below is a list of changes that I am referring to above:
In order to enable the functionality, simply select one of the menus in the User options, as shown in the below screenshot. Next time you start AX, the selected menu will be open by default.

Below is a short listing of "code patterns" used in the project, that can serve as examples for your future projects:
Most of the time you simply get the Home page, which is frustrating for a number of users. Another thing that is frustrating for them is the company account the application opens with.
The latter can actually be setup using standard application functionality in the User options form. Just set the 'Start company accounts' to the account you want for the user by default.
I wrote a small tool, that allows the user to select a preferred startup menu, ensuring that this menu is the one open every time AX client is started. Something similar existed in Axapta 3.0 application.
You can download the xpo for this tool from my SkyDrive.
Note, that it contains minor changes to a number of existing application objects.
I suggest that you compare the xpo from the import dialog and ensure that you don't override any of your changes during import - the best thing would be to re-implement these minor changes manually. Below is a list of changes that I am referring to above:
- SysUserInfo table - 1 new field was added
- SysUserSetup form - 1 new control was added. Lookup method on datasource field overridden
- Info class - startupPost method changed
In order to enable the functionality, simply select one of the menus in the User options, as shown in the below screenshot. Next time you start AX, the selected menu will be open by default.
Below is a short listing of "code patterns" used in the project, that can serve as examples for your future projects:
- SysTableLookup - for displaying a lookup form with a list of menus
- infolog.globalCache() - for storing a global reference to the navigator class
- TreeNode iteration - for finding all menu references in MainMenu
- QueryBuild classes - for constructing and filtering a list of menu references in MainMenu, used in the lookup form
- infolog.addTimeOut() method - for scheduling execution of another method in a set period of time
Labels:
addTimeOut,
Form Development,
globalCache,
infolog,
Kernel functions,
Menu,
Menu reference,
Microsoft Dynamics AX 2009,
MorphX,
QueryBuild,
Startup,
SysTableLookup,
Tools,
TreeNode,
User options
Subscribe to:
Posts (Atom)