Posts

Dynamics AX 2012 - The AutoRefreshData property on buttons

Image
In yesterday's post , we learnt about the NeedsRecord property on buttons. This is a new property introduced in Dynamics AX 2012. Today we will learn about another new property on buttons in Dynamics AX 2012 - the AutoRefreshData property. So what does this property do? The help text for the property says " If yes, the data in the datasource associated with this button is refreshed after the button is clicked. " Well that explains it. With this property on, any datasource associated with the button is refreshed when the button is clicked. Consider a scenario, where on clicking a button, an edit form opens and allows the user to edit certain field values. After the form is closed, the values in my master form will auto refresh. My initial assumption was that setting the AutoRefreshData property will eliminate the need to explictly call refresh/research after a button was clicked. I found out that this isn't the case and I was wrong . Let us look at this in more detai...

New feature in Dynamics AX 2012 - NeedsRecord property on Buttons.

Image
In Dynamics AX 4.0 and 2009, if a button's action depended on a record being present, we usually added code in the executeQuery() method of the datasource to check for the existence of a record. If a record was not found, the button was disabled. Scenarios like these required specific code to be written by the developers. With Dynamics AX 2012, this has change. There is a new property NeedsRecord introduced on all button controls, these include your plain buttons, menu item buttons and command buttons as well. Menu button groups do not have this property. The NeedsRecord property works in conjunction with the DataSource property. Now we know that the normal buttons and command buttons do not have a DataSource property? So what happens in that case? The answer is the DataSource property is inherited from the parent of the button. This could be a button group or a tab page. If the button group also doesn't have the DataSource property set, then the kernel looks for the next pa...

How to check project budget amount through code in Dynamics AX 2012?

Image
In my earlier post, I had shown how easy it is to enable budget control on projects. You can read that here . I got a couple of questions on it and I thank my readers for the interest. I found one of the question to be very generic and the scenario described was something which many customers may be doing. The scenario given was, The customer creates a lot of project transactions on a daily basis but posting of them is done through a batch only on the month end. So the customer has allocated an approved budget of 1000. We have 20 journals each with an amount of 100. Now we post these journals in a batch. So, after posting 10 journals, the whole budget will be exhausted. So from the 11th journal onwards, we will be receiving an error that budget will be exceeded by 100. Now the question was, is there any way to know before hand while creating the transaction that there isn't a sufficient budget and hence the transaction will not be posted. Well, it surely can be done with a little c...

Hands on - How to enable budget control on projects in Dynamics AX 2012?

Image
In Dynamics AX 2009, there was no out of the box support for budget control. That has changed in Dynamics AX 2012. We now have a ledger budget control framework which is nicely integrated with the other new frameworks in Dynamics AX 2012. The Project management and accounting module has built in budget control support. We just need to configure the budget parameters, allocate and approve an amount and the framework takes care of the rest. In this post, I'll walk you through how to activate budget control on a project. Open the projects list page by going to Project management & accounting -> All projects Create a new project by clicking the new button and enter the following values as seen in the image. We will have to enable budget control on the project. To do this, expand the Budget and forecast tab. Select the Use budget control check box, set Budget overrun default field to Disallow overruns. Set the project stage to In process. To do this, select In process from the...

How table and class customizations are stored in UtilElements?

Image
In my previous article on finding all the layers on which an object has been modified, I explained how the UtilElements system table can be used for this. You can read that post here . Some of my readers mailed me asking that they were not getting the correct results when querying the UtilElements table. I clarified what the issue could be. This post will discuss further on the UtilElements table and what are the things one need to be aware of when querying this table. Let us first see how table customizations are stored in the UtilElements table. Let us take the Address table as an example. On my system, I have just added a comment in the axAddress() method. As you can see in the below image, the table is shown as existing on the usr layer and you can also see the actual changes. Now I'll query the UtilElements table where name is Address. while select utilLevel from utilElements where utilElements.name == tableStr(Address) && utilElemen...

How to toggle button states using the FormButtonManager class in Microsoft Dynamics AX 2009?

Generally in Dynamics AX, we write seperate methods for controlling the state of buttons on forms and call these from the data source's active method. In Dynamics AX 2009, a new framework was introduced for this need. This is the FormButtonManager class. This class provides all the necessary methods to tap into this framework and control the state of the buttons. The idea is similiar to what we are used to do but this class provides a more clean approach. Let us take a practical approach to using this framework. We will work on the Customers form (CustTable). On the Customers form, we have a menu button named "Project Control". Now the requirement is that this button should be enabled only for customer's who are associated with projects. Now we need a provider class to provide us with the various rules which control the button states. For this purpose we will have to create a class. Each rule is created as a method in the class which returns a boolean value represen...

Quick tip: How to find your security identifier(SID) on your system?

Whenever we restore our Dynamics AX database, we have to update the UserInfo table to set the correct NetworkDomain, NetworkAlias and the SID fields. Most of us have a simple SQL script which we run whenever we need this. You may know the network domain and alias values but finding the SID value can be difficult. Well, the SID value or Security IDentifier value is a unique ID by which your system is identifier by other systems or network domains. This value is stored in the registry. Open the Windows registry by typing regedit in the run menu and navigate your way to HKEY_CURRENT_USER\Software\Microsoft\Protected Storage System Provider\S-X-X-XX-XXXXXXXXX- XXXXXXXXXX- XXXXXXXXXX-XXX This is where you can find the SID of your system. Hope this helps.