jeudi 19 janvier 2012

Update field properties from axapta x++

This job helps you to update field properties of AOT tables from axapta x++.
In this case, we'll update 'ModifiedDate', 'ModifiedTime', 'ModifiedBy' and 'CreatedDate', 'CreatedTime', 'CreatedBy' field properties of all Dynamics AX tables, excluding system tables, tmp tables, views and maps.

static void Test_DictTaules(Args _args)
{
SqlDataDictionary sqlDD;
Dictionary dict;
TableId tabId;
SysdictTable dTable;
SqlDictionary sqlDictionary;
TreeNode Tnode;
;
    dict = new Dictionary();
sqlDD = new SQLDataDictionary();

    ttsbegin;
    tabId = dict.tableNext(0);
    While (tabId)
{
dTable = new SysDictTable(tabId);
        if(!dTable.isSystemTable() &&
!dTable.isView() && 
!dTable.isMap() &&
!dTable.isTmp())
{
tNode = dTable.treeNode();
            tNode.AOTsetProperty('ModifiedDate','Yes');
tNode.AOTsetProperty('ModifiedTime','Yes');
tNode.AOTsetProperty('ModifiedBy','Yes');

            tNode.AOTsetProperty('CreatedDate','Yes');
tNode.AOTsetProperty('CreatedTime','Yes');
tNode.AOTsetProperty('CreatedBy','Yes');
tNode.AOTsave();

            sqlDD.tableSynchronize(tabId, True, False);
            dTable = null;
tabId = dict.tableNext(tabId);
}
}
    ttscommit;
    info("Process finished");
}

Aucun commentaire:

Enregistrer un commentaire