Thursday, 14 March 2013

List of objects not in Version Control in Dynamics AX 2012

Hello all,

Most of you would have been in a situation when you don't know which objects were not added in Version Control. It is really tiresome to go to individual objects and check whether we have added it or not.
Here is a simple job which will return a list of all objects that were not added in Version control system.



Description: 
The while select will loop through all objects that we need to include in the search. Then for the individual object, we check whether that object is part of Version control or not.
versionControl.allowCreate(treeNodeOfObjectToCheck) is a static method which take tree node as argument. It will return true if the object can be added in Version control otherwise false.

The above example will search complete Data Dictionary objects. To include more type of objects, just add a new condition in the where clause. The enum UtilElementType contains all the type of objects that exist in Dynamics AX 2012.

Further tweaking can be applied to this job. Suppose you don't need to search objects in all layers but the current layer in which you are working. It can be accomplished by adding another condition in the where clause.


The static method global::currentAOLayer() returns the current layer. The above condition must be added using the AND operator.

Feel free to ask if there are any queries regarding it :)