Table Field Group
From Axaptapedia
[edit] Description
The following demonstrates how to add field group fields with code.
[edit] Dynamics AX versions
Has been tested on Dynamics AX 2009 SP1 RU-6
[edit] Code
#AOT #define.FieldGroups('Field Groups') #define.TableFieldGroupItem('PROPERTIES\nTable\n#\%1\nDataField\n#\%2\nENDPROPERTIES') TreeNode table, fieldGroups, fieldGroup, field; ; // Gets the Address table. table = TreeNode::findNode(#TablesPath + #AOTDelimiter + tableStr(Address)); // Gets the Address table's Field Groups node. fieldGroups = table.AOTfindChild(#FieldGroups); // Gets the 'Delivery' field group. fieldGroup = fieldGroups.AOTfindChild(tableFieldGroupStr(Address, Delivery)); // Adds the field 'Name' to the 'Delivery' field group. fieldGroup.AOTadd(fieldStr(Address, Name)); // Adds the display method 'tableRelationName' to the 'Delivery field group. // This uses the Address table's RecVersion field as a dummy and converts it // to a display field by setting its properties. field = fieldGroup.AOTadd(fieldStr(Address, RecVersion)); field.AOTSetProperties(strFmt( #TableFieldGroupItem, tableStr(Address), tablemethodstr(Address, tableRelationName))); // Saves the changes to the table. table.AOTsave();