Hi All, I've a static method in a class running in server, which would create new BaseEnum element programmatically as below, for example.
public static server void createNewEnumElement(Args _args) { #AOT TreeNode treeNode; TreeNode subTreeNode; SysDictEnum sysDictEnum; str enumValue; str elementName; str enumerationName; #define.EnumValue('EnumValue') ; enumerationName = "ABC"; elementName = "Z"; treeNode = TreeNode::findNode(#BaseEnumsPath + '\\' + enumerationName + '\\' + elementName); if (!treeNode) { treeNode = TreeNode::findNode(#BaseEnumsPath); treeNode = treeNode.AOTfindChild(enumerationName); if (treeNode != null) { subTreeNode = treeNode.AOTadd(elementName); if(subTreeNode != null) { sysDictEnum = new SysDictEnum(enumName2Id(enumerationName)); subTreeNode.AOTsetProperty(#EnumValue, sysDictEnum.lastValue() + 1); subTreeNode.AOTcompile(); subTreeNode.AOTsave(); enumValue = int2str(sysDictEnum.lastValue() + 1); } treeNode.AOTcompile(); treeNode.AOTsave(); } } } I haven't find any issue when this piece of script executed inside Axapta irrespective of the tier where it is getting executed. But, when the above piece of code getting executed in server when the method is getting invoked by Business Connector, the new element in the BaseEnum is getting created in `SYS' layer instead of getting created in the current/top AOS layer. (The Client configuration for the BC is set to open on the current layer which is not `SYS' when it is getting invoked from BC. Moreover, the new element is getting created in the current layer and not in `SYS' layer when it is running in client tier.) Is it any way related to that BC component Interpreter, which allows the code to be executed in kernel? Is it a bug? Or Which makes the new object getting created in `SYS' layer in Dynamics AX when it invoked via BC and the code is running in server? I'd really appreciate if anyone can share some insight about this issue. Thanks in advance. Thanks && Regards, Balasubramanian Kumaran