Code highlighting

Tuesday, September 16, 2008

SysInfoAction class description - Improve your Infolog

In the last couple of weeks I have been asked about this a number of times, so I decided it would be a good idea to describe what the class can do for you.

In just a few words, this class helps you interact with your users better, helping them perform some desired action (predefined) on request. This will save some time for the user, providng for a better user

There is a number of classes already present in the system.
Just to name a few used the most:

JournalInfoAction - allows navigating to the specified journal line. This is used, for example, when checking the journal lines before posting.
SysInfoAction_Editor - opens the editor in the specified method on the specified line/column. Primarily used for development purposes.
SysInfoAction_FormRun - opens a specified form, setting focus to a specific control, if required. There are many extensions of this class, allowing for more control over what is to happen.
SysInfoAction_MenuFunction - same as the one above, but the input is a menu item that is to be launched on user action.
SysInfoAction_newWindow,SysInfoAction_AOTproperties - both are used to ease up the dev's life a bit. The first one opens the specified AOT object in a new window, the latter one - the properties for the object.

And so on...

I had to create one extension of this class yesterday as well, while doing a small tool we use inside our team. The requirements were to launch a specific external application, specifying a number of files as command-line arguments. WinAPI ShellExecute can do exactly that. So I create a simple wrapper around the WinApi::ShellExecute method that is accessible as an infolog action.

Here is an example of how this class can be used:

You can download the class from axaptapedia.

The output of the infolog, in this case, would look similar to this:

Infolog output

One other thing worth mentioning about these classes is the method infolog.infoActionObject(). This is not used as often, but provides a greater control over the infolog action by allowing interaction with an open object, like a form.
This is used in AX journals (Inventory Transfer journal, for a specific example, if you wish). Whenever you check the lines of the journal (before posting), you get an infolog in case of errors, which allows to navigate to the specific line with the error. The navigation occurs in the journal lines form currently open, which is much better than opening a new form for each line.
In order to use this, simply specify the object that needs to be available when executing the infolog action, using the method mentioned above, like the following:

infolog.infoActionObject(this); //if called from the method on a class/form, for example

For more information, check out the article on Axaptapedia (I hope it will get expanded over time :))

No comments:

Post a Comment

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