As you probably know, Dynamics AX 2012 stores data about application objects in database, instead of in .aod files used before. It also added few new elements to AOT – form parts, Visual Studio projects and so on.
In older versions, you were able to see and query some information about AOT objects in UtilElements table (and few related tables). In AX2012, a new set of tables is available, with SysModelElement table roughly corresponding to UtilElements table. Nonetheless the UtilElements table hasn’t been removed.
So what’s the difference?
Actually, neither SysModelElement nor UtilElements are actual tables – both are views defined in AX database. SysModelElement simply displays data from ModelElement table, while UtilElements view is much more complicated and uses ModelElement and several other tables (that’s why it is so slow). It only simulates how UtilElements table looked in previous versions. If you’re interested in details, look at the design of the view in the database.
You may notice a difference between UtilElements and SysModelElement in the way how they represent element types. UtilElements contains a field called recordType and its type is UtilElementType enum. On the other hand, SysModelElement’s ElementType field is a lookup to SysModelElementType table, which is actually a view again. When constructing SysModelElementType view, ElementType field from ElementTypes table is mapped to SysModelElementType.RecId, so the reference in AX looks like the usual surrogate key.
All IDs from UtilElementType enum have a corresponding record in SysModelElementType table – for example, UtilElementType::Class has ID 45 and there is a record in SysModelElementType with RecId 45 and Name “Class”. But if you dig deeper, you’ll find that SysModelElementType contains more values than UtilElementType, which means two important things:
- Some model elements types have no corresponding value in UtilElementType enum.
- UtilElements table does not contain some type of elements.
In most cases you simply don’t have to care too much. But you can’t expect to find information about, for example, events in UtilElements. Or you may get errors like “Method ‘UtilElement’ is not supported for treenode (Path: …)” when working with some TreeNode instances, because there is no valid mapping to UtilElementType.
For completeness, here is the list of all types existing in SysModelElementType table but missing in UtilElementType enum:
6 | WorkflowProcess |
8 | SysXal |
10 | LegacyMenu |
39 | LegacyFeatureKey |
52 | WebReport |
77 | CompositeQueryNode |
80 | SecurityTask |
83 | PartReference |
96 | Event |
97 | EventHandler |
100 | CueReference |
104 | VisualStudioProjectFolder |
105 | VisualStudioProjectFile |
106 | InfoPartLayout |
107 | InfoPartGroup |
108 | InfoPartField |
109 | InfoPartAction |
110 | MenuItem |
111 | MenuSeparator |
112 | MenuReference |
114 | VisualStudioProjectType |
116 | EventHandlerMethod |
120 | FormMethod |
121 | VisualStudioProjectLink |
122 | SubMenu |
123 | SubWebMenu |
124 | SubWebModule |
125 | FormDesign |
126 | FormControl |
143 | FormDataSources |
144 | SecurityPermissionSet |