Wednesday, December 3, 2008

AOTSetPropertiesExt

static void Job6(Args _args)
{
#define.TableName( 'TSTTestTable' )
#define.FieldName( 'TestField' )

#AOT
#Properties

TreeNode a,b,c;
AOTTableFieldList fields;
Struct s;
Map map = new Map(Types::String, Types::String) ;

Counter propertiesCount;
Array propertyInfoArray;
Struct propertyInfo;
str propertyValue;
int i;

;

//create table
a = infolog.findNode( #TablesPath) ;
b = a.AOTfindChild( #TableName) ;
if (!b)
{
b = a.AOTadd(#TableName );
b.AOTsave();
}

//create field
fields = b.AOTfindChild( 'Fields') ;
c = fields.AOTfindChild (#FieldName) ;
if (!c)
{
fields.addString( #FieldName) ;
c = fields.AOTfindChild (#FieldName) ;
b.AOTsave();
}

//set field's properties
s = c.AOTgetPropertiesE xt();
map.insert(# PropertyExtended DataType, 'SalesId');

propertiesCount = s.value('Entries' );
propertyInfoArray = s.value('PropertyIn fo');
for (i = 1; i <= propertiesCount; i++)
{
propertyInfo = propertyInfoArray. value(i);

if (map.exists( propertyInfo. value('Name' )))
{
propertyValue = map.lookup(property Info.value( 'Name'));
propertyInfo. value('Value' , propertyValue) ;
}
}

c.AOTsetPropertiesE xt(s);
b.AOTsave();
}

No comments:

How to identify the user that was used to change an object from AOT in AX2012

Get the object name for which we need to track these (user and date&time) information's. Login to SQL Server Management Studio an...