Thursday, December 29, 2011

How to update 'Modified by' property of Table through code

We often came accross a situation where we need to modify some property value for multiple objects. To expedite this process we do it through job. I also found a similar case. In my situation i was required to update 'Modified by' field of the table to yes so that each table will record the information of which user has modified the record. Here is the simple job for this

TreeNode TreeNode;
TreeNode BaseTreeNode;
UtilEntryLevel UtilEntryLevel;
#AOT
;
BaseTreeNode = TreeNode::findNode(#TablesPath);
TreeNode = BaseTreeNode.AOTfirstChild();

while(TreeNode)
{
treeNode.AOTsetProperty("ModifiedBy", "Yes");
TreeNode.AOTcompile();
TreeNode.AOTsave();
TreeNode=TreeNode.AOTnextSibling();
pause;
}