Cart 0

Add Flair To Your Forms With Achievements

Posted by Author, Curator, Visually Impared Squirrel Literacy Advocate & Dynamics AX Technical Solution Professional (TSP) at Microsoft on

Achievements are everywhere you look. You can get them for checking into your favorite restaurant through Foursquare, you can get them for writing code within Visual Studio, and you can definitely get them on any game that you play on your phone. So why not add them to your Dynamics AX forms so that you can add a little pizazz to day.

In the immortal words of Stan… I need to talk about your flair.

How To Do It…

Start off by finding the form that you want to add your achievements to.

Then right-mouse-click on the form, and select the Personalize option from the pop-up menu.

When the Personalization form is displayed, switch to the Information tab, and click on the Edit button to the right of the Form Name field.

This will open up AOT and with just the form that we selected showing in the explorer.

Expand out the Design section to the spot that you want to add your flair. In this case we will add it below the title on the form details.

Then right-mouse-click on the group form and select the New Control option from the pop-up-menu, and then choose the Button control.

This will add a new Button control to the group.

Within the Properties panel, update the Name.

Set the Button Display property to Image Only.

Then click on the to the right of the Image URL property so that you can browse and select an image to show for the button.

Set the Border to None so that the button shows up as a flat image… which looks nicer.

And finally, set the Back Style to Transparent so that it doesn’t look like a button J

Now we need to create a method that we will use to tell Dynamics AX if we want to show the achievement button or not. To do this right-mouse-click on the Methods folder within the AOT and select the New Method menu item.

This will open up a new X++ editor window.

Replace the code within the method with the following code.

private void updateAchievements()


int recCount;

SalesTable salesTable;


Select count(RecId) From salesTable

where salesTable.CustAccount == CustTable.AccountNum;

recCount = salesTable.RecId;

if (recCount > 1)




{“FrequentBuyer “).visible(false);



Once you have updated the code, you can close the editor.

Now we have all of the framework for our achievement. We just need to update the form to tell it to refresh for each record. To do this, expand out the Methods folder and double click on the UpdateControls method.

This will open up the X++ editor with the code that is ran every time the record is refreshed or changed.

Add the following code to the bottom of the method:


Once you have done that, save the updates and then close out of AOT.

How It Works…

Now when we open up the form, if the condition is met (in our case more than one order being placed for the customer) then everything looks normal.

But if they have met the criteria then it shows up.

How cool is that.

Share this post

← Older Post Newer Post →

Leave a comment

Please note, comments must be approved before they are published.