Code highlighting

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:
  • 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. Start Menu in User options, Microsoft Dynamics AX 2009 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

15 comments:

  1. Really, very good idea Ivan and good work.

    We used it extremely on our company for our different department teams in Ax3 now we could also use it for Ax2009 using your project.

    Many Thanks Ivan.

    hani mohd
    toti96@yahoo.com

    ReplyDelete
  2. how can i make this un-done. thnks! I am getting errors. It is giving me errors at:


    #void startupPost()

    ReplyDelete
  3. Well, you should just see what is different in the xpo, and remove that.
    But it should not give you errors. What specifically are the errors you see?

    ReplyDelete
  4. Hi Yvan.
    I integrated your tool user preferred startup menu....nice tool.
    With the current menus it works perfect.
    With menus made by us it doesn't work.
    Can it has to do something with this code
    infolog.navPane().selectedGroup(SysUserInfo::find().StartupMenu);
    Is ther some code to startup our own menus
    thanks geert
    gvaneeckhout@deknudtmirrors.com

    ReplyDelete
  5. Hmm. I think it should be able to show the user menus as well. Strange
    No, the code you posted above is just selecting the menu.

    You should look into the lookup - they should show up there (in the user options).

    ReplyDelete
  6. HI,
    can you tell me where to modify to control the companies on the navigation pane. i want to restrict the user groups to particular companies. i have done it on the sysdataarea select form looking to restrict from the address bar as well.

    Regards

    ReplyDelete
  7. You should be able to limit the available companies through setting up security restrictions for data in DataArea table, as far as I know.
    I don't know of a way to restrict access specifically to the list in the address bar.

    ReplyDelete
  8. very useful... thanks for this

    ReplyDelete
  9. Hello,
    Very good job, very interesting. But I have a problem with the lookup method of the startmenu field. The first time, the menu list is correct, if I clik a second time on the lookup field, the same menu is visible several time il the menu list. I didn't find where to modify that.
    Have you idea about this problem?
    Thank you for your help.
    Reagrds

    ReplyDelete
  10. Hello,
    Sorry, I forgot to leave my email address in the previous post : nobug51@hotmail.com
    About my previous post, I found this : if the startmenu field is blank, the menu list (in the lookup field) is correct.
    After selected a menu in the list, for example Administration menu, if you click a second time in the lookup field, there are 5 times the administration menu : 5 is the layer number where there is developments. If the startmenu isn't blank, it seems that the code queryBuildDataSource.addGroupByField isn't executed. If you delete the startmenu, in the lookup, there is a only one administration menu in the list.
    That's weird. Have you a idea about that?
    Regards.

    ReplyDelete
  11. Hello,
    I have a problem with the lookup method of the startmenu field. The first time, the menu list is correct, if I clik a second time on the lookup field, the same menu is visible several time il the menu list. For example, the first time the administration menu appears only one time in the lookup field. If you select a menu in the list, you click a new time in the lookup field, the administration menu appears 5 times. I think there is a link with the different layers where there was developments. It would seem the code querydatasource.addgroupfield isn't executed. If you delete the startmenu (blank), no problem, after selection of startmenu, the same menu appears many times.
    I didn't where is the problem, are you an idea about that?
    Thank you for your help
    My details : jeanclaude.ragon@gmail.com

    ReplyDelete
  12. Thanks for such a wonderful post. Appreciate it.

    Is it also possible to change the initial splash AX screen to our company logo? Thanks in advance.

    ReplyDelete
  13. Hi Santosh,
    I don't think it is possible to change the AX screen without modifying the executable, which I cannot talk about

    ReplyDelete
  14. This is interesting topic but your link to xpo was invalid. Could you please provide with latest link?

    ReplyDelete
    Replies
    1. Updated the link.

      Do note this is quite old - so meant for older Dynamics AX versions

      Delete

Please don't forget to leave your contact details if you expect a reply from me. Thank you