Getting attributes in X++

In X++, you can decorate classes and methods with attributes. Attributes were added in AX 2012 (I believe), where the typical use case was a definition of data contracts. They’re much more common in F&O, because they’re also used for CoC and event handlers. For most developers, attributes are something defined by Microsoft and used …

Continue reading ‘Getting attributes in X++’ »

The power of well-designed code

My previous blog post reminded me a refactoring that I did on one of my previous projects (in AX 2012). I needed to adjust a piece of logic and found that it’s implemented as a method with more than two thousand lines. Of course, nobody could understand what’s going on there. Such code in unmaintainable. …

Continue reading ‘The power of well-designed code’ »

Compare records in code

When saving a record, I had to check which fields had changed and react in a special way if only certain fields (and not any other) changed their value. I could iterate all fields and compare their values in two table buffers (the original and the updated one), but I thought that D365FO might already …

Continue reading ‘Compare records in code’ »

First chance exceptions

Dynamics 365 for Finance and Operations runs completely in “.NET”, which has some interesting implications. The runtime and tools working with it (such as Visual Studio) offer many new options that may be very useful. One of these options is the ability to catch first chance exceptions. When an exception is thrown, it’s considered a …

Continue reading ‘First chance exceptions’ »

Label ID fix

I recently saw an interesting problem with labels in AX 2012 – two customizations created different labels with the same IDs, therefore the newer won and the older one showed completely wrong texts in GUI. For example, one customization created a form with caption @XYZ1 = “Customers”. Another customization created a label with the same …

Continue reading ‘Label ID fix’ »