Embrace the extensions mindset with Dynamics 365 for Finance and Operations #2 – SysExtension framework [EN]

In my previous post Embrace the extensions mindset with Dynamics 365 for Finance and Operations we reflected on some of the patterns we can leverage to create our customizations by using only non-intrusive changes based on a real example: Adding a new Number Sequence to a standard module.

In particular, we discussed:

  • Metadata Extensions — to add a new Enum Value in a standard Base Enum.
  • Class Extensions — to add a new method to a standard class.
  • Chain-of-Command — to add a block of code to an existing standard class method.
  • Event-Handler subscription — to subscribe our own method to an existing standard delegate provided as an extension point.

If you still didn’t read that blog post, please take a moment now. If you already did it (thanks!), let’s continue with another pattern we have to consider: SysExtension Framework (also SysPlugin, that is quite similar).

This pattern allows us to create new sub-classes for factory methods without any over-layering or coupling with the original hierarchy. Therefore, we can add new sub-classes in our own packages without any intrusive modifications and replace a very common pattern, widely used all over the application, like this (taken from AX 2012 R3):

static SalesCopying construct(SalesPurchCopy salesPurchCopy)
{
    <strong>switch(salesPurchCopy)</strong>
    {
        case SalesPurchCopy::CreditNoteHeader       : return new SalesCopying_CreditNote();
        case SalesPurchCopy::CreditNoteLines        : return SalesCopyingCreditNoteLine::construct();

        case SalesPurchCopy::CopyAllHeader          :
        case SalesPurchCopy::CopyAllLines           :
        case SalesPurchCopy::CopyJournalHeader      :
        case SalesPurchCopy::CopyJournalLines       : return new SalesCopying();

        //
        case SalesPurchCopy::VoidFiscalDocument_BR  : return new SalesCopying_VoidFiscalDocument_BR();
        //

        default                                     : <strong>throw error</strong>(strFmt("@SYS19306",funcName()));
    }

    <strong>throw error</strong>(strFmt("@SYS19306",funcName()));
}

This pattern has many of problems to be extensible. The most obvious is likely the throw error on the default case, that makes impossible to an extension class to subscribe to the Post event on the method to add new cases. But even deleting this throw sentence (that has been indeed deleted in many standard methods as a quick way to make them extensible), the pattern itself is still a problem. If a new customer or partner customization or even a new standard module needs a new case, this class needs to be modified and the full package compiled and deployed.

 

Read the full article at “Dynamics AX in the Field”, the blog from the Premier Field Engineering team at Microsoft.

 

AX Performance Monitor 101 – Tips and tricks to deal with performance counter files [EN]

Windows Performance Monitor for Dynamics AX

 

In my previous blog post, I explained how to setup Performance Monitor (PerfMon) to proactively capture performance data while cleaning old files to keep disk space under control. This is, let’s say, our ideal scenario, but sometimes setup is not that specific and we need to deal with suboptimal files that contains the performance data we need to analyze:

  • We have too many files
  • We have too few files
  • We have some huge file that makes analysis or processing it too slow
  • We have files captured in different languages

Let’s have a brief description on how we can deal with some situations by introducing a couple of small but useful tools:

PAL – Performance Analysis of Logs

PAL is a small but really useful tool created by Clint Huffman that takes one perfmon counter file and creates a nice HTML report with graphs and descriptions that can be used as starting point for performance analysis. It’s not that the tool replaces a manual in-deep analysis of any potential problem, but it helps giving some tips that can be used to start looking for something else.

 

Read the full article at “Dynamics AX in the Field”, the blog from the Premier Field Engineering team at Microsoft.

 

AX Performance Monitor 101 – Setup Perfmon for continuous monitoring with rolling files [EN]

Windows Performance Monitor for Dynamics AX

 

Windows Performance Monitor (PerfMon) is likely the most useful tool (together with our DynamicsPerf package) to monitor and diagnose performance problems related with your Microsoft Dynamics AX infrastructure and, in general, for any software running on Windows operating systems. Given its importance, is surprising how many people is not using it properly or, even worst, is not using it at all.

I will briefly explain how to setup PerfMon to collect performance counters in all servers for continuous monitoring, creating log files per day, compressing and deleting old files to minimize disk space, along with some tips and tricks during the process:

Create and configure a Data Collector Set

  • First of all open Performance Monitor either going to Administrative Tools in Windows Control Panel or searching “perfmon” in the Start menu.
  • Navigate to Data Collector Sets > User Defined > Right Click > New > Data Collector Set.
  • Choose “Create from a template” and finish the wizard. Some nice templates for all Dynamics AX server roles can be obtained as part of our DynamicsPerf download, under “DynamicsPerf 2.00\DynamicsPerf\Windows Perfmon Scripts” subfolder or as part of the PAL tool. We will talk about PAL on the next post on this series.

 

Read the full article at “Dynamics AX in the Field”, the blog from the Premier Field Engineering team at Microsoft.

 

Embrace the extensions mindset with Dynamics 365 for Finance and Operations [EN]

A couple of weeks ago, we launched the last platform update 10 (August 2017) for Dynamics 365 for Finance and Operations, Enterprise Edition and, as in almost every release, there were changes regarding the Application Extensibility Plans.

A lot of effort is being invested in the journey to a non-intrusive way to extend the application, and it needs to be understood as a critical change in the way we think about customizations. More information about future plans can be found in the Dynamics Roadmap (Filter – Application: Dynamics 365 for Finance and Operations; Area: Extensibility).

But sometimes it’s hard to change our mindset just by looking at these out-of-context upgrade notes, so I want to show how we can leverage some of the latest improvements to the X++ platform by looking at some real-life examples.

Keep in mind the basic principle: we want to avoid intrusive changes.

 

Scenario 1: Create a number sequence in a standard module

This is a common scenario and the good news is that it has barely changed from Dynamics AX 2012. In our example, we will add a new number sequence to the Accounts Receivables module (Customers) to provide new values for the custom MSVRMInsuranceProviderId EDT. To accomplish that, we need to make some small changes (plenty of examples of AX 2012 code available out there):

 

Read the full article at “Dynamics AX in the Field”, the blog from the Premier Field Engineering team at Microsoft.

 

Why you should be using Team Foundation Server for Dynamics AX lifecycle management? [EN]

If you already use Team Foundation Server in your Dynamics AX projects, providing all benefits it can give to your teams, or if you are already convinced to use it soon, then this article is not for you.

You may not be convinced or, even worst, you may disagree about it to be beneficial to your methodologies and team behaviors. You can try to challenge my points with your project’s circumstances that make TFS unacceptable. That’s fine. I’m only asking you to read the full article first 🙂

Microsoft Application Lifecycle Management

Team Foundation Server (or Visual Studio Team Services*) is a tool, and as such, it will allow you to achieve the same tasks faster and with less effort. Furthermore, TFS will also give the ability to execute crucial tasks that are only available by using this kind of tools. Those tasks are mostly related to development work and source code management, what makes developer’s life easier, but some of them also help project managers and consultants, and support Quality Assurance guidance and validations, testing and all the rest of Application Lifecycle Management steps, whichever methodology is used to manage our projects: Microsoft SureStep, Agile, Scrum, …

Not to mention that using TFS is mandatory in the new Dynamics 365 for Operations, so including it in our lifecycle processes today will ease the transition and will put in place a set of Best Practices than will improve your team since day one.

Let’s have a look at the benefits of TFS in the three main categories of Application Lifecycle Management:

  1. Work
  2. Code
  3. Build & Release

 

Read the full article at “Dynamics AX in the Field”, the blog from the Premier Field Engineering team at Microsoft.

 

Unit Testing X++ code in Visual Studio (AX 2012) [EN]

I’m pretty sure everybody who has tried will agree with me that the Unit Testing framework included in the AX 2012 development environment (aka MorphX) has some limitations. Sometimes such limits become so impacting that makes the framework almost useless when the code you need to test starts growing (let’s discuss design problems in a separate post :)).

But I’m not going to talk here about limitations, but about what we actually can do, and one of such things is to use X++ proxy classes to write our unit tests in Visual Studio, and use the native testing framework included here with all its possibilities. Let’s see how it works with an easy example.

I wrote this simple X++ class in order to have something to test:

Continue Reading…