Summary: New Microsoft Dynamics AX Packages, models, and projects

Since Microsoft released the technical specifications of the new Dynamics AX (aka AX 7) , it was clear that the application technical consultants need to change the way of thinking about Dynamics AX. Those who worked with previous Dynamics AX versions will realize the new code concepts and terminologies introduced in the new Dynamics AX. In this article I will describe the main components used in new Dynamics AX development environments.

Visual Studio is the only development environment for the new Dynamics AX (MorphX IDE is no more used). Below are the main Visual Studio components used to manage Dynamics AX elements:

Elements (metadata)

Elements are stored on disk as XML files, these files contain the Metadata and source code for the element. An example of elements: tables, queries, forms..etc. The XML files are the unit of Source Control.

Notes: below notes are just an FYI, you should always use Visual Studio to manipulate elements

· You can literally create elements using text editor

· You can move elements between models by cut & paste between model folders

Projects

Elements can be customized once they are added to a specific Visual Studio project.

Project may only belong to a one model.

Models

A Dynamics AX model is a group of elements that typically constitutes a distributable software solution (including customizations of an existing solution). A model is a design-time concept. An example of models: warehouse management model, a project accounting model …etc.

Model can have one or more projects.

Model may only belong to one package.

Packages

A Dynamics AX package is a deployment and compilation unit of one or more models. It includes model metadata, binaries, cubes and other associated resources. One or more AX packages can be packaged into a deployment package, which is the vehicle used for deployment on UAT and production environments. Packages are packaged into a deployable package file for deployment to Sandbox or production environments.

Package can have one or more models.

Packages can have references to other packages, just like .NET assemblies can reference each other.

image

Figure: Packages

The new Dynamics AX is packages replaced the old AX 2012 model stores database.

A package folder contains a descriptor folder that lists all models belong to the package:

Model Descriptors

A model descriptor file contains metadata about a model’s properties.

image

Figure: Model descriptors

Below figure shows a sample diagram showing the relationships between packages, models and projects:

image

Figure: an example of relationships between packages, models and projects

Creating Packages and models

This task can be achieved by following below steps:

From Visual Studio Go to Dynamics AX (menu) > Model Management > Create Model (wizard)

Under Add parameters tab complete the following:

Model name Enter the name of your new package as well as your new model
Model publisher Enter the name of the organization
Layer Choose the appropriate layer (Usually cus for customizations or var for value added resellers)

 

Note: in previous AX versions we had to enter “license code” in order to access specific layer, this is not required any more

Version The model version
Model description Some useful information about the new model
Model display name Defaulted to “Model name”, update model display name if you wish

image

Figure: Create Model, Add parameters tab

Enter model parameters and click Next button

Under Select package tab you will be presented with 2 options:

Create new package Select this option if you are creating a new package. By default the name of this package will be similar to model name entered in previous screen
Select existing package Select this option if you want to add the new model to an existing package. If this option is enabled then you will need to select from the drop down menu

image

Figure: Create Model, Select package tab

Select Create new package option and click Next button

Under Select referenced models select the existing models that you have the elements you will need to extend in your new model

image

Figure: Create Model, Select referenced models tab

Click Next button

You will be presented with Summary tab. This tab will summarize what have been selected in previous tabs in addition to 2 options:

Create new project Select this option to create a project to be added to current Visual Studio solution
Make this my default model for new projects By default when you created a project it will be added under this new model

image

Figure: Create Model, Summary tab

Click Finish button

If you have checked off Create new project option, then you will be presented with New Project screen:

For the sake of this exercise we will select Dynamics AX7 project.

image

Figure: New Project

Congratulations you have created your first AX package, model and project in just few clicks!

Modifying Models

From Visual Studio Go to Dynamics AX (menu) > Model Management > Update model parameters (wizard)

Under Update model parameters tab select the following options:

Model name Select the model name you wish to modify
Model publisher Enter the name of the organization
Layer Disabled option
Version The model version
Model description Some useful information about the new model
Model display name Update model display name

image

Figure: Update model parameters

Click Next button

Under Select referenced models select/deselect models

image

Figure: Update model parameters, Select referenced models

Click Next button

Under Summary tab, Click Finish button

image

Figure: Update model parameters, Summary tab

Click Finish button

View Package Dependencies

From the Dynamics AX menu under Model Management find View Package Dependencies option. This is going to open up a DGML file which is a graphical file that shows all the dependencies of the different models in the system.

image

Figure: View Package Dependencies

Building Models

From Visual Studio Go to Dynamics AX (menu) > Build models

Under Models tab, select the model(s) to be built

If you check off Build referenced models option, then assemblies/models that the selected models reference on are also built.

image

Figure: Build Models, Models tab

Under Options tab, the following options are available:

Build Pre-compiled Form Build pre-compiled forms for all selected models
 Build Reports Build reports for all selected models
Build Aggregate Measurements Build aggregate measurements for all selected models
Build Best Practice Checks Build best practice checks for all selected models
Synchronize Database Synchronize database for all selected models
Build cross reference data Build cross reference data for all selected models

image

Figure: Build Models, Options tab

Click Build button to start compilation and build process.

Creating Deployment Packages

After you are done with building your application code, your next step to generate a deployable package that can be uploaded to Dynamics Life Cycle Services (LCS) Asset Library to be published to a Sandbox or production environment. This can be achieved by following these simple steps:

From Visual Studio go to Dynamics AX (menu) > Deploy > Create Deployment Package

image

Figure: Create Deployment Package

From Create Deployment Package window select the package containing your models you want to deploy and folder location for the generated deployment package:

image

Figure: Create Deployment Package window

Click Create button and wait few minutes:

image

Figure: Deployable Package

Your deployment file is ready to be uploaded to LCS > Asset Library!

 

References:

· Microsoft Dynamics Technical Conference, Seattle (February 2016)

· 80730AE: Development Basics in Microsoft Dynamics AX

We had this question asked on one of the internal AX forums, and Michael Fruergaard wrote a short description of each method you can use.

Re-posting it here with some extra comments, so that new developers can read and understand, when to use what method.

There are “only” 5 ways to close a form:

  • Close - close the form. Similar to the 'X' button.
  • CloseOK – close the form, and set the OK flag – called by the Commandbutton::Ok
  • CloseCancel – close the form, and set the Cancel flag – called by the Commandbutton::Cancel
  • CloseSelectRecord – close the lookup form, and set return record
  • CloseSelect – close the lookup form, and set return value


The below methods (note their names are in past-tense) are used to determine if or how a form was closed:

  • Closed – Returns true, if the form is no longer open
  • ClosedOK – Return true, if the form was closed by the user clicking ‘OK’
  • ClosedCancel – Returns true, if the form was closed by the user clicking ‘Cancel’


Finally, CanClose() is called inside super() of any of the close methods. If CanClose() returns false, the form is not allowed to close.