TreeNode::isValidObjectName Method [AX 2012]
Determines whether the string passed as an argument can be used as a name for a node in the Application Object Tree (AOT).
A candidate name must meet the following conditions:
-
The first character must be a letter.
-
It can only contain letters, numbers or an underscore.
-
It must not evaluate to a token.
This method does not check if an element of the same name already exists. It only validates that the argument is a valid name for an AOT object. Duplicate names may not exist within classes, tables, extended data types, or enums.
The following example gives examples of valid and invalid arguments.
boolean validName;
validName = TreeNode::isValidObjectName('ValidName'); //true
validName = TreeNode::isValidObjectName('Name with spaces'); //false
validName = TreeNode::isValidObjectName('4StartsWithDigit'); //false
validName = TreeNode::isValidObjectName('Illegal;Character'); //false
validName = TreeNode::isValidObjectName('if'); // false (token name)
Show: