AX7: Using event handler on protected and private methods

Hi everyone, some classes on AX have their methods as “protected” and this blocks the possibility of the use of “event handler”.

Some of those classes you should analyse and to make the minimum possible of the use of “customization” i’ll show a easy way to make a method hock-able for event handlers.

One of the classic event handlers that we cannot use are on the NumberSequence classes.

Let’s take a look at the NumberSeqModuleRetailParameters, this class have the method “loadModule” that are usually customized to create new number sequences for the Retail module.
With AX7 we should always try as maximum as possible use Extensions and EventHandlers to don’t have customizations to be merged in future updates, etc, but in this case the method are “protected” witch don’t give you the option to create event handlers.

Capture

Customize the class, before the declare of the method use the attribute Hookable = true as below:

Continue reading “AX7: Using event handler on protected and private methods”

AX7: Using event handler on protected and private methods

AX7: Display method on table extension

On AX7 we don’t have the option to create methods on table extension, so we should use the extension class to do that. The example below will show how to create a display method on the table extension class and use on a form extension.

First create your table extension class and your display method following the example below:

public static class MyCustTable_Extension
{
    [SysClientCacheDataMethodAttribute(true)] //This attribute will cache your display method.
    public static display Name myDisplayName(CustTable _this)
    {
        return _this.nameAlias() + "myDisplayName"; //Do here your display method as usual.
    }

}

To use your display method on the form, create your new field on the form extension and use the property as below:

Continue reading “AX7: Display method on table extension”

AX7: Display method on table extension

AX7: Access “form controls” from a “form extension” via “Event Handler”

With the new form extension capability on AX7 we cannot create methods and change the iteration with the new controls (form controls) on the form extension. One basic example are enable and disable a new button control based on the Activate method of a Datasource, that was common on AX2012.

To do that without customization, you have to create your new button on the form extension and use Event Handler on the Activate to enable\disable the button. See the example below:

I created a new form extension (i’m using the CustTable form). I added a button and copy the event handler “onAtivated” of the CustTable datasource and paste on a new eventHandler class.

The code below will access the control:

Continue reading “AX7: Access “form controls” from a “form extension” via “Event Handler””

AX7: Access “form controls” from a “form extension” via “Event Handler”

AX7: Using table event handler

Event handlers can be use to fire up your code without the necessary to customize and interfere on core logic and elements.

On the example below i’ll create an event handler that will initialize my new fields that I created using extension on the CustTable.

Find the method that you want to create the event handler, right-click and choose if you want to create a Pre or Post event handler.

1.JPG

Create a new classe and use the paste the eventHandler to create your method.

Continue reading “AX7: Using table event handler”

AX7: Using table event handler

AX7: Using the run time performance tool

Hi everyone, with AX7 now it’s possible to use a quick and basic tool to monitor the performance of your application on run time.

To make the use of this tool, simple type on your browser after the Dynamics AX 7 address the complement “&debug=develop”.

A timer will be shown before the Search text box and if you click you will have a more performance information about your actions on AX7.

Capture

 

Capture

AX7: Using the run time performance tool

AX7: Create automated test scenario using Task Recorder

With AX7 we can use the Task Recorder to generate black box test scenarios, import and use as Automated Test on VS.

Using Task Recorder your consultants, PMs and developers can generate setups, simple test and end to end tests scenarios, export and the developer can import on VS to generate automated test classes.

Below i’ll show an simple examples of the creation of a test scenario using the Task Recorder and the generation of an automated test class based on the record.

To use the task recorder, open AX using the internet browser (don’t use the run mode from VS, the task recorder doesn’t work from there).

Continue reading “AX7: Create automated test scenario using Task Recorder”

AX7: Create automated test scenario using Task Recorder