Skip to main content

Posts

Showing posts from January, 2016

Dynamics AX7 Development 6–Adding Delegates for Customised Code in Higher Package

Dynamics AX is split into multiple models the main ones are as follows; Application suite, Application Foundation and Application Platform. If you look at some of the debendencies you see how the organization of model affects the assemblies (how it is compiled). In some cases you have to modify the Foundation or the Platform. The issue with that is you are unable to reference code sitting in a higher package (model). In short a higher model can take dependencies and access elements in a lower model but not the other way around. To get around this limitation you have to use a delegate method. Below is an example of a delegate. The PrintMgmtDocType has a method to get the default report form. See how the delegate method is called from the Foundation and uses an EventHanderResult to pass around the result. The delegate method doesnt have to have any code. It is there to allow other methods to subscribe to it. Now this is the calls in the Suite. Notice how to subscribe by adding

Dynamics AX7 Development 5–More on extensions (Table extension)

Previous post compared the difference between overlaying and extending. It is clear the benefits of extensions. So to continue that discussion, in this post I will look at extensions by adding a field to a table. Right click on a table you want to extend (ie you want to add a new field). This will create a table extension SalesTable.Extension. See that in the project (right hand side in the Solution Explorer). Open up the table design. You can now drag an EDT or create it by right clicking. The bold items are what have been added to the extension. The greyed items are what is in the base. Thats it. We have added a new field to the table without having to modify the base table.

Dynamics AX7 Development 4–Overlay or extend

In this post I will look at the decision of overlaying or extending. In AX7 you can extend metadata by adding a field to a table or adding a control to a form, and extend business logic by defining event handlers. You can now write event handlers on several pre-defined events on tables, forms, form data sources, form controls, and others. Below we are going to look at a basic example comparing Overlay with Extending (using event handler). As mentioned there are many forms of extensions but for simplicity we will focus on one (event handler). Overlay Overlaying is when you modify existing code by changing the system behaviour. For example lets look at overlaying the initValue method on the CustTable. Right click on the object and click Customize. This will add it to your project. You will see a little [c] to indicate it is a customised object. I added a bit of code to the initValue method. Notice how it has changed colour to indicate it has been customised. Extension (using ev

Dynamics AX7 Development 3–Create a new form

Lets have a look at creating a form. This is probably a little more exciting than the previous posts. As this is totally new to AX7. Right click and Add > New Select the Form object from the AX7 Artifacts Initially it will show the pattern as unspecified. This is something we should always set if we expect our form to work across platforms (browsers). Otherwise we can set it to custom and it is free form. Which is a bit messy and unsupported. Right click the Design and apply a pattern. Once you have applied a pattern the bottom part of the form will show you the expected pattern. Now it is a matter of filling it up with the required control types. Lets right click New > control we want to add. Once you have added all your required controls. Drag the table from the AOT to the Data Sources node. It should look something like this. Now you can preview by clicking the tab. Build your VS project. There should be no errors. If you want to debug and run in a browser. Ma

Dynamics AX 7 Development 2 – Create a new table

In continuation with my regular AX posts on development basics. In this post I will describe how to create a new table. I won’t go into detail about best practices/indexes/relationshipts etc. Just a basic table creation. Right click the project > Add > New item Create an EDT and give it a name. Now drag the EDT tot he Fields section in the table design. On the project property make sure to tick the “Synchorinse Database on Build” Now build your project. This will build the code and synchornise the table to the database. Right click and open in table browser. This will open up a window with all the table fields.

Dynamics AX 7 Development I – Create a model

With the recent release of AX7 CTP8 public preview there are a lot of things to learn. I thought I would do some basic series of tutorials to explain a few concepts and how to get around for developers. In this first one I will explain how to create a model. Click on Dynamics AX > Model Management > Create model Follow the wizard by entering a name and a publisher This is very important if you want to create extensions or if you want to customise existing functionality by over-layering (which we try to avoid as much as we can). After you finished you can create a new project in that model. In the Application Explorer there are two views Model View – Shows the AOT divided into its models. Each model has its own subset of the AOT (elements that belong in the model) Classic View – Shows a single AOT classic view we are used to You will notice in the Packages folder that the model folder was created under the application suite. Good reference material available