Now that Dynamics AX R3 is available you may be working with the new Warehouse Management browser client. And if you are like me, opening up the browser window and then typing in the URL (http://localhost:82) may just be too much work and giving you serious carpel tunnel syndrome. Don’t worry though, if you want to write a couple of lines of code then you can easily add a menu item to your Tools menu that will open the mobile client up with just a click of the mouse.
It’s like having your own personal Stargate… sort of…
How To Do It…
- To start off, access the Tools menu by clicking on the Files menu and then clicking on the Tools sub-menu. There is more than enough space for another menu item.
- The first task that we need to do is create a Class within AOT that will open up the web page for us. To so that, open up AOT and then expand out the Classes folder.
- Right-mouse-click on the Classes folder itself, and select the New Class from the context menu.
- Now you should see a new generic Class.
- Change the Name field within the Properties pane to something a little more useful like WHSMobileDeviceBrowser and then double click on the class.
- This will open up the code editor for the Class.
- Press CTRL+N to create a new method for the class.
- And then change the method to be:
- static void main(Args _args)
- Then close out the editor.
- To test the code, just right-mouse-click on the class and select the Open menu item.
- This should open up a browser window for you and take you straight to the mobile device portal.
- Now we need to create a Menu Item that will call the class. To do this open up the Menu Items group within AOT and expand out the Display group.
- Right-mouse-click on the Display node and select the New Menu Item option.
- This will create a new generic menu item for you.
- Change the Name property to something a little better than the default – like WHSOpenMobileDeviceBrowser.
- Then change the Client Type to Class.
- This will allow you to select your Class that you created in the last step.
- Finally, give the Menu Item a Label and Help Text before saving the change.
- You can test the Menu item just like you did with the Class by right-mouse-clicking on the menu item and selecting the Open menu item.
- If everything is configured correctly then the browser window should open up again.
- Now for the last step, which is to add the menu item to the Tools menu. To do this, open up the Menus group within AOT and find the GlobalToosMenu object.
- Right-mouse-click on it and select the New menu item and the Menu Item sub-menu option.
- This will add a new menu item to the end of the menu.
- From the MenuItemName dropdown, select the new menu item that you just created.
- This will automatically update the Menu Item Name for you.
- Now just save your changes to AOT.
- Now if you open up the Tools menu you will see a new menu item for opening the browser window.
- Clicking on the menu item takes you straight to the client.
- If you want to make it even better, you can make one small change – if you click on the login button, you will notice that the URL is slightly different.
- If you change the main() method to point to that URL rather than the base one then you will even bypass the splash screen.
Now we’re cooking with oil.