Extension instance variables within static Dynamics 365 FO form event handlers

To extend a form in D365 for Operations, we can use pre-defined events and form delegates. Event handler methods on a handler class can be assigned to them to be called when the event is triggered (For more info, see my previous post AX7 Extensibility – Part 3 : Event handlers and delegates (hooks)). As you know static methods can be called without creating a class instance and cannot access its class instance variables.

What if we need to access a class instance variable within these static event handlers?Like for example, the ‘counter’ variable below within the handler class?

final class TSExtensionInstanceTestHandler
    private int counter;

    [FormControlEventHandler(formControlStr(TSExtensionInstanceTest, Counter), FormControlEventType::Clicked)]
    public static void Toggle_OnClicked(FormControl sender, FormControlEventArgs e)
        FormRun formRun = sender.formRun();
    [FormControlEventHandler(formControlStr(TSExtensionInstanceTest, Test), FormControlEventType::Clicked)]
    public static void Test_OnClicked(FormControl sender, FormControlEventArgs e)
        FormRun formRun = sender.formRun();

Continue reading “Extension instance variables within static Dynamics 365 FO form event handlers”

WebAssembly, a new era of web platform programming

Today Javascript is the most accepted client side programming standard for the web platform. Originally designed as a simple scripting language to write small logic into HTML pages (as “script” in it’s name implies), today it is immensely used in modern web projects, together with massive sized open source Javascript libraries like Angular, React, Backbone, Ember. The demand for browser based applications is getting higher everyday since creating a browser based application is undoubtedly the best option if you want to create a multi platform and multi device application. Therefore many enterprise applications today, like ERP and productivity applications target world wide web as their development platform.

Although it is pretty “the standard” technology for today’s web client programming, is Javascript alone able to handle those future requirements of heavy, functionality rich enterprise applications?

In this article we will have a quick look at one of newest technologies in browser based application programming, the new “WebAssembly” technology, and explain its potential impact for the future.

Continue reading “WebAssembly, a new era of web platform programming”

Simple server-side scripting with ASP.NET Razor

With the introduction of .NET framework and ASP.NET in the late 1990s, the legacy HTML embedded single page web application model of ASP is replaced by the Web Forms (and later ASP.NET MVC model). While the new ASP.NET models brought many new possibilities and made it easier to create enterprise web applications, the simplicity of legacy ASP was left behind.

Continue reading “Simple server-side scripting with ASP.NET Razor”

Using .NET attributes for D365 FO child class constructors

Previously, we used to define class constructors like below if we want to switch correct child class via a parameter :

public static AtTest constructFromCommon(Common _common)
 AtTest ret;

 case tableNum(CustTable) :
 ret = new AtTest_Customer(_common);
 case tableNum(VendTable) :
 ret = new AtTest_Vendor(_common);

return ret;


Since AX 2012, we have the ability to create and use .NET attributes and in D365 FO they are widely used in the extension framework.

Continue reading “Using .NET attributes for D365 FO child class constructors”

Generating deep links for D365 FO forms and records

Dynamics 365 FO has an API to create URL links that point to certain forms and records, in other words “Deep links”. This way you can share a record or query within AX with others for example within an e-mail, or inside an extensible control you have written.

Below I give an example method, used in a runnable job, which generates a deep link for a record on a form, using a single field as a query parameter. To be able to test it, cop and paste the code into a runnable class and run it in USMF company of D365 one-box development environment:

Continue reading “Generating deep links for D365 FO forms and records”

AX7 (D365) Chain of command with examples

As of platform update 9 of Dynamics AX for Operations, we have a new extension possibility called chain of command. Now we are able to add pre and post functionality to extensible methods in a much easier and readable manner than the previously used event handlers, also we are now able to access protected methods and variables directly in the extended class without problems.

Now let’s check how it works with an example. Create two classes, one is the base class of the other and add a method we want to extend called ‘testMe’. Add infolog calls inside the method to track the execution :

Continue reading “AX7 (D365) Chain of command with examples”

Using 3rd party Web components in AX7; an introduction to extensible controls

AX7 allows you to develop new user interface components called ‘extensible controls’ using HTML, Javascript and other web programming technologies. You can also integrate any of the thousands of existing web based plugins and code libraries inside AX user interface and use them directly with AX data. Building ‘extensible controls’ in AX offers endless possibilities to enrich standard AX7 user interface and forms.

However, learning how to write an extensible control is a subject of its own. It is not straightforward and simple as programming other parts of AX and I think having a good knowledge in HTML and web programming is a must to be able to understand it. The documentation and github examples provided by Microsoft is limited, but by studying the functionality yourself, doing examples and examining existing controls in AX7 webroot folder, pieces of the puzzle start to fit together.

Here in this article I will show the basics of how to integrate a third party web plugin and use it in an AX7 form. I have chosen weareoutman’s ClockPicker as an example and will show how to create an alternative, better looking AX time edit control with this plugin and add it to AX forms:

Continue reading “Using 3rd party Web components in AX7; an introduction to extensible controls”

Using base64 encoding and decoding for file transfer in AX 2012

If you want to transfer small file data using AX and do not want to make use of shared folders or file uploading, sending your file directly inside your XML message as base64 encoded string is a good option. Base64 gives you the possibility to encode your binary data as text and transfer it inside text based message types like XML and JSON and decode it back as a file on the receipt.

For big files though, like 10MB and bigger, I recommend using binary file transfer instead of base64.

Ax 2012 has built in support for decoding and encoding base64 data type with some missing things and drawback we will mention in this article. I do recommend using AX standard methods to do it and not .NET equivalents in AX 2012, because I doubt marshalling such huge amount of data between CLR Interop and AX performs good enough.

Continue reading “Using base64 encoding and decoding for file transfer in AX 2012”

AX7 Extensibility – Part 3 : Event handlers and delegates (hooks)

In the previous blog post we had a look at the possibilities of adding new methods and variables to existing AX7 program code using extensions. What if we need to modify, or add extra functionality to existing methods or events on existing classes, tables and forms? In that case we use AX7 events and delegates (also called ‘hooks’).

There are already plenty of events (hooks) we can subscribe in AX and extend the existing functionality without overlayering or overriding the function we need to extend. You can find those under the “Events” node of the application objects. Subscription is as easy as right clicking and selecting “Copy event handler method”, then you need to paste it into an eventhandler class and write your own logic inside:

public static class ExtensionDemoInventTableEventHandlers
[DataEventHandler(tableStr(InventTable), DataEventType::Deleted)]
public static void InventTable_onDeleted(Common sender, DataEventArgs e)
 InventTable inventTable = sender as InventTable;

//Your logic


Continue reading “AX7 Extensibility – Part 3 : Event handlers and delegates (hooks)”