Setting Field properties by using X++

Hi Guys,

I am creating a table by using X++ code.I want to set the field properties . Please let me know how to set the field property by using x++.

Thanks in Advance…

TreeNode.AOSsetProperty() is what you need. Check out this example:

#Properties
TreeNode fieldNode = TreeNode::findNode(@"\Data Dictionary\Tables\Address\Fields\Name");
;
fieldNode.AOTsetProperty(#PropertyMandatory, enum2str(NoYes::Yes));

Thanks Martin…

Hi Martin,

Suppose i want to set the left property through code then how i will use ?

Reply with simple example

thanks in advance

#AOT

str myProp;

TreeNode treeMenuItem,treetable;

// set properties

treetable = TreeNode::findNode(@"\Data Dictionary\Tables\TestTAble\Fields\Building");

treetable.AOTsetProperties(“PROPERTIES\n Label #” + ‘Build’ + “\n ENDPROPERTIES \n”);

treetable.AOTsave();

myProp = treetable.AOTgetProperties();

info(myProp);

I don’t know which Left property are you talking about, but it should be quite clear from my code that property name is the first parameter of AOTsetProperty().