Tuesday, 1 November 2016

Building and Consuming Data entities in Dynamics 365 for operations

Data entities are new concept introduced in Dynamics 365 for operations. The main purpose of data entities is to provide a single platform for data management. Additionally they also provide foundation for the services framework. It also enables file integration and recurring integrations.
Data entities replaces the AxD and DIXF frameworks of AX2012 and also simplifies ALM process where we can create data packages and export import between different environments.

Below diagram shows how data entities provides platform for different scenarions.


You can think of data entities as updatable views to tables.Let's do a quick walkthrough on developing and then exporting/importing data using  data entity for a custom table.
To keep it simple I created a new table with 2 fields, ID and Name. Remember to have unique index defined on the table and use it as the primary index on the table. Below is the table structure:

 To create a data entity for this table we can either using entity wizard by right clicking on the table and then selecting the AddIns option (as shown below)

or by adding a new item of type data entity in the project.
Let's add it manually , select data entity on the add new item screen

Select the primary data source, in this case it will be our new table
The entity category field is to tag the category of the entity. It will help to filter the entity on the client.
The check box to enable public API is used to expose the entity via OData. If we turn it off then the entity will still be available for data management platform but won't be accessible via OData.
On the next page system will show the list of all the fields in the table you have added . This screen is quite interesting and important as you can setup your entity.
We can uncheck some fields if we do not want to expose, or make them mandatory even if they are not mandatory for tables.
We can add more data sources if we want. Let's leave it as is for now.

Once finished, system will create some artifacts  - A staging table, entity and related security privileges.

Staging table has some system generated fields like the definition group, execution ID etc.

Build the solution and synchronise the table.

We can now view the entity in the list of entities available under data management workspace

We can filter the list

 We can view the structure and mappings from the options on the form

So now we are done with creating a new entity for a custom table.
Let's import some data in the table: I created a csv file with two fields and the data as the entity structure is quite straightforward in this case

Enter the new import job details, select format and entity name and then click on upload

Once you click on upload you can select the csv file having data of your desired structure


Click on Import and then we get the below notification
We can view the execution summary

Once the data is imported we can see the details and the job status

View the  data with the help of inquiry buttons on the form
We can browse the table and view the data as well.
Lets add new record and save it from table browser


Now lets do a quick export of the data. First we create an export job
Click on Add entity after defining the data format and the entity
Once the mapping is done, click on export , the job is scheduled

Once the job completes, we get a notification

We can view the execution details

We can also download the file created by the job by clicking on the ellipse and download file 


Open and view the file. We can see the new row we added is exported

This was just a simple and quick walkthrough on how to develop and use data entities. Data management platform in Dyanamics 365 for operations offers lots & lots  more exciting stuff. Keep exploring and keep sharing.  Comments and feedbacks are appreciated. Thanks for reading the blog. 


Monday, 10 October 2016

Form patterns in AX 7

Hi Friends,
In the new AX, aka AX7, form patterns are introduced. These are evolution of the AX 2012 form templates so they have similar benefits and reasoning when comes to justifying there use. The way they work are bit different though. There were only few form templates in AX2012 but in the new AX, microsoft has introduced a whole new bunch of patterns. A major advantage is maintainability and upgradability of the forms. If a form is having a pattern applied to it then it will be easy to upgrade in future releases of the new AX.

The current form pattern is shown on the desing node. If there is no pattern applied then it is shown blank as shown below:

In order to apply a pattern , right click on the design node -> select Apply pattern and then choose the pattern from the list of available patterns, as shown below

Lets apply Simple list and detals - list grid pattern to our form. Once we apply the pattern, the expected form desing pattern is populated in the pattern tab. It shows which controls are missing, to match it to the pattern

As you start adding the controls to your design, the pattern tree keeps updating itself. In the below pic, as I added an Application bar, the control in the tree changes the state.

I added the remaining controls on the design.


We notice that there is a warning symbol next to a few controls. To view what is missing, click on the control under the design node. The particular control structure, as expected from the pattern, will be shown and we can see that we are missing few controls there.

Now we can add the missing controls 

Similarly we can do for other nodes in the design.

Another intresting thing which is new in AX7 is that we can apply sub patterns as well. I can apply a pattern to a tab page. To view the available patterns on the tab page, we can right click on the control and select apply pattern and view the available patterns as shown below:

One more intresting thing is that we can generate a form pattern report. To do this, go to Dynamics AX menu --> Addins --> Run form pattern report.

This generates a csv file which then can be examined to view which standard forms are using which patterns. It is very useful to build your solution as this can help us decide which pattern should be used for the new form. 
There are some great articles on Ax wiki related to form patterns: