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...
Recently, I was asked to help with an issue in one of our development environments. The scenario was that we were importing bank statements in text format into Dynamics AX and then creating a log file on the system. I was told that this code was working fine but all of a sudden they were seeing the below error when running the process in batch. The server-side impersonated (RunAs) session tried to invoke a method that is available for client-side processing only. The above error occurs only when a code running on Server tries to call a code which is bound to run on client. So whats the bigs issue, you will ask? Why cant the server code call the client code. This will be a problem only when there is no open client. For example, code is running in batch on the server and there is no open client. To fix this, they had overridden the runsImpersonated() method and were explicitly returning false. I explained them that, this meant that their batch code will run on the client instead of the ...
In Dynamics AX 2012, the dimensions framework has gone for a complete makeover. We can now have an unlimited number of financial dimensions. In Dynamics AX 4 and Dynamics AX 2009, the dimensions were actually stored as an array of string fi?>elds. This has changed in Dynamics AX 2012 where the dimension is stored as a recid. Recently I came across a requirement where if the CostCenter dimension was set to a particular value, the department dimension's value should change to a different value and vice versa. I developed the code and thought it will be a good idea to share it here. My requirement was in the ProjTable form but you can use this code in any of your form which uses the default financial dimensions. Override the DefaultDimension field's dataChanged() method on your main datasource and add the below code. // Financial dimension change code - Zubair - Begin public void dataChanged() { DimensionAttribute dimToBeChanged; DimensionAttributeValue dimAttr...
Comments