Posts

“Day in the Life Benchmark” available for download

Microsoft has recently released the Day in the Life Benchmark documents on PartnerSource. You can read more about it on the Dynamics Ax Performance Team Blog . The benchmark numbers shared there are really encouraging and truly shows that Dynamics AX 2012 is a robust and agile erp platform to base your business on. Note: PartnerSource or CustomerSource login is required.

Get selected records in Dynamics AX 2012

Image
In my earlier post, we discussed how we can retrieve all selected records on a list page. You can read that post here . Retrieving all selected records from a caller form is very easy. The code for this can be found in a number of places in standard Dynamics AX codebase. The general approach is to use the dataSource.getFirst(1) statement to get the first selected record and loop through the remaining using dataSource.getNext() . In Dynamics AX 2009, a new class was introduced for this purpose. This was the MultiSelectionHelper class. In Dynamics AX 2012, another new class has been introduced to retrieve the selected records. This is the MultiSelectionContext class. The MultiSelectionHelper class is an application class. It presents two constrcutors. The standard constructor method just creates a new instance of the MultiSelectionHelper class. When this construct is used, you will have to explicitly set the dataSource to be used for fethcing selected records. This can be done...

New security model in Dynamics AX 2012

Image
In Dynamics AX 2012, one of the key area that has gone a total overhaul is Security. In Dynamics AX 4.0 and Dynamics AX 2009, the security model was module based. Users were assigned to user groups which grouped permissions to the various objects. These permissions were controlled by security keys. The biggest drawback of this model was that you could not have the same security user group apply across multiple companies. You still had to create the same user group across different groups. With Dynamics AX 2012, all this has changed. The security model in Dynamics AX 2012 is role based. This means that you can relate the day to day business processes to roles. Users are assigned to roles. Roles contain a group of duties or privileges. It is logically very easy now to configure security in Dynamics AX 2012. The Security keys in the AOT are now obsolete in Dynamics AX 2012. It is present for backward compatibility. If you right click on the Security keys node, you dont have an option ...

How to get list page's datasource in Dynamics AX 2012?

Image
Recently, I had a requirement where I needed to disable a button on a list page if the records selected did not meet a particular condition. Let me explain you this with an example. Say I have a new button on the Projects list page. This button should be enabled only if all projects selected have the same project contract ID. If the contract ID is different for the selected projects, the button should be disabled. So how can we achieve this? On a form, this can be done in a very straight forward way. Just loop through all the selected records and check if the project contract IDs are different. If they are, just disable the button. But on a list page, the form datasource is not readily available. After some investigation, I found out a way of doing this. As you must be knowing, all list pages in Dynamics AX 2012 are controlled via interaction classes. This is the new framework model. If you are new to this and dont know about these, I'll recommend you learn more on this on the H...

QueryDataSourceStr - new intrinsic function in Dynamics AX 2012

There is a new intrinsic function introduced in Dynamics AX 2012. This is the QueryDataSourceStr() function. This function returns a string of the datasource name. The queryDataSourceStr() function checks if the supplied datasource name exists in the query in the AOT or not. An important point to note here is that all the intrinsic functions like formStr, classStr, queryStr and queryDataSourceStr invoke real time compiler check. This means that the compiler checks for the existence of the object in the AOT as soon as the function call is completed. In case the object name is not found, an error is shown immediately by displaying a red squiggly line.

Form templates in Dynamics AX 2012

Image
A primary focus in Dynamics AX 2012 was to increase a developer's productivity by automating common tasks. As part of this initiative, a new feature was introduced in Dynamics AX 2012 in the AOT. This is the creation of new forms using form templates. If you right click on the form node, you can see an extra option there - New Form from template As seen in the image above, you have an option to create seven different form based on the pre-defined templates, these are ListPage DetailsFormMaster DetailsFormTransaction SimpleListDetails SimpleList TableOfContents Dialog DropDialog Let us look at these in more details. ListPage - A list page is a form that displays a list of data related to a particular entity or business object. A list page provides provisions for displaying data and taking actions on this data. Every module has at least a couple of list pages. List pages are further classified as primary and secondary list pages. A secondary list page will only displa...

Debug BP errors in Dynamics AX 2012

Image
With Dynamics AX 2012, some new BP errors have been introduced. Often, while fixing BP errors, I turn to the List of Best Practice Error and Warning Messages page on MSDN for help. But what if you are getting a BP error and there is no clear description on how to fix it. In such scenarios, I always debug the BP error and try to see what is causing this BP error in the first place. Let us do this with a simple example. On a Dynamics AX 2012 machine, Create a table with just two fields, ItemId and Name. Create a normal relation on the table with InventTable on ItemId == InventTable.ItemId On running the BP check on this table, among other BP errors, you will receive this new to Dynamics AX 2012 BP error - Only foreign key constraints are allowed on this table. Some of you may know the reason why this BP error is being thrown. For those who do not know the reason, please hold on to that doubt, I'll explain it shortly in the end. Let us get back to the original topic of th...