Monday, 10 October 2016

Form patterns in AX 7

Hi Friends,
In the new AX, aka AX7, form patterns are introduced. These are evolution of the AX 2012 form templates so they have similar benefits and reasoning when comes to justifying there use. The way they work are bit different though. There were only few form templates in AX2012 but in the new AX, microsoft has introduced a whole new bunch of patterns. A major advantage is maintainability and upgradability of the forms. If a form is having a pattern applied to it then it will be easy to upgrade in future releases of the new AX.

The current form pattern is shown on the desing node. If there is no pattern applied then it is shown blank as shown below:

In order to apply a pattern , right click on the design node -> select Apply pattern and then choose the pattern from the list of available patterns, as shown below

Lets apply Simple list and detals - list grid pattern to our form. Once we apply the pattern, the expected form desing pattern is populated in the pattern tab. It shows which controls are missing, to match it to the pattern

As you start adding the controls to your design, the pattern tree keeps updating itself. In the below pic, as I added an Application bar, the control in the tree changes the state.

I added the remaining controls on the design.


We notice that there is a warning symbol next to a few controls. To view what is missing, click on the control under the design node. The particular control structure, as expected from the pattern, will be shown and we can see that we are missing few controls there.

Now we can add the missing controls 

Similarly we can do for other nodes in the design.

Another intresting thing which is new in AX7 is that we can apply sub patterns as well. I can apply a pattern to a tab page. To view the available patterns on the tab page, we can right click on the control and select apply pattern and view the available patterns as shown below:

One more intresting thing is that we can generate a form pattern report. To do this, go to Dynamics AX menu --> Addins --> Run form pattern report.

This generates a csv file which then can be examined to view which standard forms are using which patterns. It is very useful to build your solution as this can help us decide which pattern should be used for the new form. 
There are some great articles on Ax wiki related to form patterns: