Monday, 14 March 2016

Setup and Configuration of Visual Studio

Setup and Configuration of Visual Studio that will make the development experience with AX a little smoother.
1. Organize projects by element type: The first option we want to set is to organize projects by element type.  To do this, we'll go to the Dynamics AX menu and we'll choose options.  In the left navigation pane, under the Dynamics AX group, we want to expand that and choose projects.  The first checkbox says organize projects by element type.  We want to make sure this is checked so that when we create projects and we add elements, they're organized and easier to find.

2. Line numbers & Word wrap: The next setting from the same options is in the text editor group.  So we'll expand this and we'll go to all languages.  We want to make sure that line numbers checkbox is enabled so that in our text and code editors, we can see the line numbers.  This makes it easier for development and debugging and also make sure that Word wrap checkbox is enabled




3. Enable IntelliTrace option: The next setting is in the IntelliTrace group.  So we'll click the root node on the IntelliTrace group and we'll uncheck this enable IntelliTrace option.  We do not want this enabled because it's not supported with X++ debugging and it could cause performance issues.  So we'll uncheck this and choose OK.

4. Best Practice:
a)     Under Dynamics 'AX 7', select the Best Practices node.
b)    Select Microsoft.Dynamics.AX.Framework.BestPracticeFramework.UIRules.
c)     Make sure that Microsoft.Dynamics.AX.Framework.CodeStyleRules is selected.
d)    Select Microsoft.Dynamics.AX.Framework.DataAccessRules.
e)     Select Microsoft.Dynamics.AX.Framework.DataEntityRules.
f)      Make sure that Microsoft.Dynamics.AX.Framework.DeprectatedElementsRules is selected.
g)    Make sure that Microsoft.Dynamics.AX.Framework.MaintabilityRules is selected.
h)    Select Microsoft.Dynamics.AX.Framework.StaticCodeValidationRules.



     Then we'll restart Visual Studio to make sure our changes are taking effect.

Sunday, 13 March 2016

Creating and deleting the model from Microsoft Dynamics AX 7

In this post I am going to explain how to create a model.


To create a model, We have to navigate to 'Dynamics AX 7' menu -> Model Management -> Create Model..


This will open up a wizard for creation of model.
Now In AX 7, there are 2 approaches for the development.

  • Extension approach -> This is the recommended approach. It creates separate assemblies for the elements of the model. Advantage is that it requires virtually no upgrade efforts when new product versions are released. But it has some limitations, We will discuss those in later posts 
  • Customization approach -> This is similar to over-layer approach which is followed in AX 2012 or earlier versions. It will update the same assemblies in the same package. When it comes to upgrade, this requires quite a lot of efforts 

Model creation for extension approach

When you are creating a mode, you need to decide which approach you are going to take. Let see how to create extension model first.
When the wizard is opened, you have to provide Model Name, publisher, Layer, Version, Description and ModelDisplayName(This will be shown everywhere in the visual studio).



I Prefer to keep the name as <Model>Extension. Here I am creating extension model for Application Suite.
Click Next.

Select whether to create model as an existing package or create new package. For Extension approach, you will have to select create new package. Click next.

Select the referenced packages. It is important to reference appropriate models. You can create extensions of the elements which belongs to these selected packages.
There are 2 approaches for models here.
  • You can create extension model per original model. For example ApplicationSuiteExtension model for ApplicationSuite and LedgerExtension for Ledger Model
  • You can create one extension model for all the extension objects. For example VINExtension model for both ApplicationSuite and Ledger model. In this case you reference to all models from which you need elements.
I personally prefer creating extension model per original model. Here I am selecting Application Suite model as reference model. (I could not select Application Platform in this form, there is option to update model later. In that option you can change the referenced models)

Review the summary screen and click on Finish. If the Create new project checkbox is checked, New screen for creating new project will be launched. 
Give name to project same as model (recommended). Either create a new solution or you can add project to existing solution.

This will create new project. Now you can add elements to project and start customization.

Model creation for Customization approach:

When the wizard is opened, you have to provide Model Name, publisher, Layer, Version, Description and ModelDisplayName(This will be shown everywhere in the visual studio).

I Prefer to keep the name as <Model>Custom. Here I am creating customization/overlayer model for Application Suite.
Click Next.


Select whether to create model as an existing package or create new package. For customization approach, you will have to choose select existing package. Click next.

On this step you will see the difference. When you create new package, you get option to select the reference models, but when you add to existing package, you do not get to select the reference packages. As you see in the above screenshot, there are few reference packages already selected. I guess these are same as the original model which created this package. Finish the review and click on finish


Give name to project same as model (recommended). You have to create new solution here which is different from our first project where we had option to use the existing solution.

This will create new project. Now you can add elements to project and start customization.

In AX7 there is no database for the model. Model and elements are stored in XML format in the file system. These new models will be created under C:\Packages
For extension model, New folder is created under Packages folder. But for Customization model, new folder is created under the existing package.

Description of each model is stored under the Descriptor folder.


It is good to know these details, but refrain from making any changes to these files directly. You should always edit from Visual studio.

Deleting model:

I could not find any way to delete the model from Visual studio but you can directly go into the explorer and delete following things:
  • Solution created for the project(model)
  • For Extension model, Package folder created for that extension model.
  • For Customization model, folder created for the model under existing package and the descriptor xml file for the model.
Beware that I could not find any documentation anywhere but found it via experience. This may not be correct way and it may create unexplored problems

Microsoft Dynamics AX 7 terms - Element, Project, Model, Package, Solution and their relations

In this post I am going to cover basic terminology of Dynamics AX 7 development.



Element: Element is the object in the AOT(Application Object Tree) such as tables, classes, forms etc.

Project: Project is a small, manageable group of elements. If you want to customize the element, it needs to be added to the project. Project always belongs to only 1 model. We can use project files to import/export between different instances of AX. It is saved as .AXPP file.   

Model: Model is defined as collection of elements that represent a distributable software solution. This included all the elements and the Metadata. Model belongs to only 1 package. You can modify elements belonging to same package where the model belongs. Model is a unit of development/customization.

Package: Package is a deployable container. It contains source files (XML files), resources and DLLs. It is similar to Model store of AX 2012. You can select one or more packages and create a deployable package, which can be used to move the code from one environment to other. Packages are stored under c:\packages folder. For every model new sub folder will be created under package folder. Package is unit of deployment.

Solution: Solution is a virtual grouping of projects in Visual Studio. In Visual Studio you can add project from same or different models from one or more packages.

Following is the diagram showing this structure.
  • Element is a part of project.
  • One element belongs to only one model and can be customized only in that model once.
  • Project is a part of model.
  • Model Can have many projects.
  • Package contains one or more models.
  • one model belongs to only 1 package.
  • Solution is Visual studio solution which can contain models from different packages.
  • Solution is Virtual grouping created for ease of managing the development objects.  
Following is the screenshot from the Visual studio:


Above solution has multiple models from different packages.
Models are of both customization models as well as extension models.



Above screen shows each model and corresponding packages.

How to start development for Microsoft Dynamics AX 7 in 7 steps

The biggest step to start developing and learning AX 7 is to get the AX 7 VM. Follow 

the steps and start doing it :)


1. Click on downloads:


2. Click on download link and download the VM files, extract them and you will 
get the Hyper-V ready VHD file.

3. Once your VM is ready you can get the details about login and password 
from AX 7 Help page.
https://ax.help.dynamics.com/en/wiki/access-microsoft-dynamics-ax-7-instances-2/

4. Make sure your VM has access to internet.
Access to internet is required because, AX 7 uses Azure Active Directory for the 
authentication. Once you have logged in, you don't need access to internet, everything 
else is then run locally on VM. 

Some useful links

Microsoft Dynamics AX 7 help
https://ax.help.dynamics.com/en/

Microsoft Dynamics AX 7 VM download (Partnersource login required)

Microsoft Dynamics Learning Portal (Partnersource login required) - Video tutorials
https://mbspartner.microsoft.com/AX/CourseCatalog






Microsoft's ERP solution


Work smarter than ever before with intelligent tools for the modern workplace. Bringing together the best from Microsoft, Microsoft Dynamics AX enables you to make smarter decisions, redesign business processes faster and fuel business growth.
“The ability for Microsoft (Dynamics AX) to support a hybrid cloud environment is essential to meeting the real needs of customers... Dynamics AX leapfrogs ahead of anyone else in the industry.”
-Josh Greenbaum, Principal Analyst, Enterprise Applications Consulting