This table forms part of the broader topic of Reflection APIs in AX. More on this later.
UtilElements table belongs to a set of Util prefix tables which contain all element definitions. In other words, these tables give you direct access to the content inside .aod files.
Lets see this table in action.
Suppose you want to find all classes beginning with Proj and that have been changed within the last month. One way to achieve this will be as follows.
static void findProjClasses(Args _args) { UtilElements ue; ; while select name from ue where ue.RecordType == UtilElementType::Class && ue.Name like 'Proj*' && ue.ModifiedDateTime > DateTimeUtil::addDays(DateTimeUtil::getSystemDateTime(), -30) { info(strfmt("%1", ue.Name)); } }
You can also use the UtilElements table to find out objects belonging to a particular layer or maybe to fulfil a more specific requirement like listing all the static methods belonging to a particular table. For eg,
static void findStaticEmplTable(Args _args) { UtilElements ue; while select name from ue where ue.recordType == UtilElementType::TableStaticMethod && ue.ParentId == tableNum(EmplTable) { info(strfmt("%1", ue.name)); } }