Microsoft made some significant improvements to the new Dynamics 365 for Operations development environment, and I want to take this chance to share with you the programming methodology and differences for Microsoft Dynamics® AX 2012 as compared to Microsoft Dynamics 365 for Operations (MsDyn365).
First, I will describe the overlaying model which is still relevant and how many AX 2012 programmers use it today. That functionality may never go away due to the type of items and their specific requirements that are needed for programming.
Second, I will describe the extensions programming model which allows you to take existing objects and extend their functionality. A benefit of this approach is that your extended objects can be separate code branches and projects that eventually are pieced together for promotion that are not reliant on the base code. Plus it has the huge advantage of being able to resist upgrade upset. Because of this your upgrades will not be as likely to be adversely affected as a result of your custom code and you are less likely to require complete re-testing or re-validation after an update from Microsoft.Included in both areas will be code samples and screenshots that illustrate the approaches.
If you have taken one of my programming courses or you have seen the materials for development out on TechNet or MSDN, you will have experience with layers. Much like the Microsoft model of planetary geological layers, these layers surround each other with the highest levels under the control of the customer. This methodology is based on the concept that you overlay or modify directly existing Microsoft code and repurpose for your benefit. It has the advantage that you don’t have to retype other methods to inherit functionality. It still works well within the AX 2012 world.
The issue comes when you want to do an upgrade or apply a significant CU patch release. If you overlay a class, a table, a form or security, the objects are subject to having new functionality brought from the Microsoft SYS layer now being exposed up on upgrade. For example the CU release includes new workflows and the security for those workflows are included in the role at the SYS level. This may be a wanted condition; however, in most cases this creates more work. This would be reflected in the review of the code to keep compliant with security segregation or for extensive software validation. The advice going forward is to explore ways to do it by extension instead. Or when you edit a modification think about how it could be done differently today.
Picture of overlaying a Security role
For MsDyn365 a few objects still need overlay for their functionality. As of the writing of this article, objects such as Form properties will need an overlay to change their behavior. For example when you are building a workflow on a form that did not have workflow functionality before, you will need to overlay the form using a project within the model that it is created in to create the new form properties. This may change with future releases; however, it is what you need to do today.
With AX 2012 the time to start using the extensions programming model is now. By using base classes as starting points your code can be independent of the upgrade process. Plus by a simple call to super() you can inherit the functionality. An example of this is easy to find in the AX2012 Classes node. Find any data processing class and view the class declaration. You will find that by extension, the class derives all of the functionality to create a report. Plus you can build new functionality linked via attribute to the temp table, contract class, or query.
Base class extension model in AX2012
The objects that you can extend are expanding up on each release of the software. For early pre-release copies much of this functionality did not exist and was discussed in the Development Basics course available as eLearning on the Dynamics Learning Portal or the IT Vision site. RSM Technology Academy also offers this class virtually and hosted on your site.
With a simple right mouse click on a menu you can create and extension of it in your project. Or in the case of tables you write a class that extends the methods on that table.
Right mouse click for Extension
Here is a code sample showing an extension of the SalesTable.
Example of an extension class to extend the table methods
This article reviewed the methodologies for overlaying and extension for both AX 2012 and MSDYN365. We explored the changes that AX 2012 programmers can make today so that their code conversion process will go more smoothly, plus they will be prepared for the new environment. In addition, we covered what those programmers that are working with MSDYN365 need to know now about their environment to really harness the power of extension.
Remember that this is a changing process as the programming model matures and much of what was covered in this article is based on the current release of Dynamics 365 for Operations. Future articles will explore both the new changes coming in November for MsDyn365 and those that will be impactful in Spring 2017 that will affect overlaying and extension. Be sure to visit http://academy.rsmus.com for more information and training materials that will cover this and 100’s of other topics for AX 2012 and MsDyn365. Plus you can follow me on twitter @DAXShaun for the latest course information and product releases.
You can contact our Dynamics AX and Dynamics 365 experts at RMS 855-437-7201