Tools and tutorials for Microsoft Sustainability Manager, Microsoft Cloud for Sustainability, Microsoft Emission Impact Dashboard, as well as Microsoft Dynamics AX aka Microsoft Dynamics Supply Chain Management (F&O)
Code highlighting
Tuesday, May 15, 2007
(DAX 3.0) SysExportDialog form extension
I found this to be very convenient, that's why I wanted to lay my hands on the SysExportDialog form and add this feature in there as well.
And that's exactly what I did today.
This turned out to be a task a little harder than I'd hoped, because there are special methods on the TreeNode class that allow to see the type of the object. Those methods are not present in DAX 3.0 yet, so I had to write something similar (probably on a more primitive way, as this is the only place the code will be used - unlike the DAX 40 modifications which are now available everywhere the Treenode Class is used)
Also, I "fixed" a small issue that was present in DAX 4.0 with this: exporting an entire node of objects (e.g, Forms) resulted in the following name of the file : "_Forms.xp".
Anyway, here is the xpo file -- notice the neat name of the file ;). -- download Form_SysExportDialog.xpo
The file contains the SysExportDialog form only.
The original form was taken from DAX 3.0 SP5 KR2.
Hope you like it as much as I do ;)
Monday, May 14, 2007
3 great Tabax Plugins
Before installing any of the plugins, you need to install Tabax 0.3 or later and the DEV_TabaxSDK
Use the following link to download the latest version of Tabax and SDK: http://axaptapedia.com/Tabax
DEV_TabaxPlugin_OpenInAOT – download
(homepage - http://www.axaptapedia.com/DEV_TabaxPlugin_OpenInAOT)
This is a very simple plugin, based on a tool I made a while ago (you can download the original EditorScript at http://www.axaptapedia.com/Editor_scripts_OpenInAOT).
This tool is available only to developers (SysDevelopment security key).
Installation instructions are very simple: just import the project and refresh the AOD (this is specifically needed for the rich AX4 client)
Now you can open AOT objects just by typing their name in the Tabax form edit box (prefixed with ‘go’).
Here are a couple of examples:
- “go InventTable” will open the Tables\InventTable node.
- “go InventDimDevelop” will open the Macros\InventDimDevelop, etc.
DEV_TabaxPlugin_RecentProjects - download
(homepage - http://www.axaptapedia.com/DEV_TabaxPlugin_RecentProjects)
This plugin, when started (which happens automatically on startup of Tabax), adds a button on the Tabax toolbar. (it resembles an ‘Undo’ button).
This plugin keeps track of projects you use during the day, providing for a simple and fast way to open one of them.
This tool is available to developers only. If you do not have developer rights, the button will not be added to the toolbar.
Here is a list of what will happed when the button on the toolbar is pressed:
- A context menu is rolled down showing the list of projects recently used. (maximum 15 projects are shown, but the number can be changed in the plugin ClassDeclaration method)
- The first 10 entries are assigned hotkeys (1 to 10 (0) respectively).
- If Ctrl key is pressed, the last closed project is opened (the selection form is skipped).
- If Shift key is pressed, the selection form is opened, providing more functionality than the context menu.
- In the context menu of the selection form you can find menu Items that clear the contents of the recent projects list or control startup project settings.
- You can cancel the form by pressing Esc or the CloseDialog button in the top right corner
To users using Sidax this button will be very familiar, as it mostly copies the functionality available on the RecentProjects tab there.
DEV_TabaxPlugin_RecentWindows - download
(homepage - http://www.axaptapedia.com/DEV_TabaxPlugin_RecentWindows)
This plugin, when started (which happens automatically on startup of Tabax), adds a button on the Tabax toolbar. (it resembles a green ‘Recycle Bin’).
This plugin keeps track of windows you use during the day, providing for a simple and fast way to open one of them again.
This includes editor windows, AOT object windows and regular Axapta forms (this does not include forms opened from other forms).
This tool is available to both dev and non-developers. If you do not have developer rights, the AOT and editor windows are not kept track of and the recent windows list is used solely for DAX forms.
The nice part of this is the specific record you last used is remembered as well, so you can reopen a form and start working with the record right away. (AxPath is used for this)
The functionality of the toolbar button is similar to DEV_TabaxPlugin_RecentProjects.
That's it. Come back for more :)
Monday, May 07, 2007
Now I am a MCBMSS in Dynamics AX
More than 2 years have passed since the day I took my last certification exam.
Today I passed the AX 40-508 (DAX 4.0 Development Introduction) exam, so now I am a Microsoft Certified Business Management Solutions Specialist in Dynamics AX.
Don't you love it how certification titles get longer and longer every time their name is changed? :)
As for the exam itself, I should say that it was a little bit of a disappointment. At least, I was expecting more from it. Basically, it was the same DAX 3.0 Development Exam, with only 5 or so questions added for Dynamics AX 4.0. Of course, it's a DEV INTRODUCTION exam, so I guess I shouldn't be expecting much from it.
Anyway, I will be anxiously waiting for the MorphX Solution Developer Exam. Hope they will actually try to write some new questions for this one. ;)
Wednesday, April 25, 2007
My blog is now a Dynamics AX Related Community
You can see the list of related communities if you follow this link
Dynamics AX Tutorials - Tutorial 2 - Classes\Box
Specifically, the following is covered in this tutorial:
- A short description of the system class BOX
- Creating a form from a class (using classFactory), launching different form methods, waiting for the form to be closed by the user and returning the selection
- Differences in implementation between DAX 3.0 and DAX 4.0
You can download the project from the following link:
Classes\Box is a simple class used throughout the DAX application. It provides an interface for showing a standard dialog with a number of selection options and a short message. This is very useful, especially during development, because it provides a fast way to show some kind of text information to the user.
The class contains a number of methods that can be extended with new ones (as shown below). All the methods are static and have the keyword client in the declaration, which forces the code in them to be executed on the client side.
The most commonly used methods of this class are:
- box::info("message"); (for debugging purposes),
- box::warning("message"); (for showing a warning message that the user won't miss)
- box::yesNo("Message", dialogButton::Yes"). (for allowing the user to select the course of action for the underlying business logic)
All the methods mentioned above are simply creating an object of class DialogBox, which is system and doesn't allow to see its implementation. This class is therefore not covered in this tutorial.
----------------------
The rest of the methods is rarely found in the application code, and is suited for specific situations where you need to provide the user with the option of choosing from more options. (for example, when imporing a project, you see a dialog created by the method box::yesAllNoAllCancel();
The implementation of these methods is very much alike: (example mentioned above)
client static DialogButton yesAllNoAllCancel(str _text, //messageDialogButton _defaultButton, //default dialog button
str _title = "@SYS11132") //dialogTitle
{
Form form;
Args args;
Object formRun;
;
args = new Args();
args.name(formStr(SysBoxForm)); //form SysBoxForm is used to show the message
formRun = classFactory.formRunClass(args); //creating a FormRun object
formRun.init(); //calling init of the form
formRun.setTitle(_title); //setting title of the form (caption)
formRun.setText(_text); //setting message
formRun.setType(DialogBoxType::YESTOALLNOTOALLBOX); //setting the type of the form
formRun.setDefaultButton(_defaultButton); //setting the default button
formRun.run(); //calling run of the form
formRun.wait(); //waiting for user action
return formRun.dialogButton(); //returing the user selection
}
The example creates 2 objects that are needed to run a form from code:
Args args - not discusses here (used to specify the name of the form that is being created)
Object formRun - that is the actual object of the form being created.
You might have noticed that it is of type Object and not FormRun. (using the base type)
This is done on purpose, as there is no compile-time validationg of methods actually existing on the form. If the method doesn't exist, you will receive a runtime error, which is not really appropriate in a live environment. So in your code you should chech that the methods being called do actullay exist. (Global method formHasMethod can be used for this purpose)
After the form is initialized and all the setMethods() are called, the Run() method is called. This method executes the form and shows it on the screen.
After the Run Method we see a call to formRun.wait(); This method notifies the RunTime that the code execution should stop here and wait until the form is closed. (if this method is used on a form to call a child form, the parent form cannot be closed before the child form)
[Note: The alternative method here is the detach method (behavior of MenuItem calls)]
After the user closes the form, the dialogButton method on the form is called to return the selected value. [Note: Notice, that the methods on the form are still accessible, even though the form is already closed by the user. This happens because the formRun object is not yet destroyed]
-----------------
I added another method to the box class - yesNoWaitForm. It opens a form that looks kinda cooler than the standard forms, because it has the option of autoclosing after a set period of time. Well, everyone can find his own uses for this form. The form name is Dev_SysBoxForm and it is an almost complete duplicate of the system SysBoxForm form. The only big difference is that this form is set modal, and that the text of the default button is appended with the remaining amount of time before the form is autoclosed. [Note: SetTimeOut method is used, which is not covered in this tutorial]
There were differences in implementation (compared to the sytem form SysBoxForm). The main are listed below:
- DAX 4.0 already has a modal window option (wait(TRUE)); So custom methos are removed from the form
- DAX 4.0 has the minimize and maximize system buttons visible on the dialog form, and they had to be turned of on the form design.
- In DAX 4.0 The return value of method formRunObj.dialogButton() was not automatically converted to the correct type. So an extra variable way added to the method to convert the result to a specific type of DialogButton. [Note: I think that this is a bug]
- The font size of the html (message) was increased by 1, because the default font size seems too small to read.
The project also includes a job that contains a couple of examples of using the new method. Enjoy!