Thursday, November 9, 2017
Database logging using X++ in AX 2012
Use below code to add tables into database logging using X++
The code below will add all the fields of the specific table for database logging. Just replace InventItemSalesSetup with the table you want to use for database logging. You can also put the code in a loop to select group of tables.
static void setDBLogOnTable(Args _args)
{
TableId tableId = tableNum(InventItemSalesSetup);
DatabaseLog log;
SysDictTable dictT = new SysDictTable(tableId);
SysDictField dictF;
Set fields;
SetEnumerator se;
log.logType = DatabaseLogType::Update;
log.logTable = tableId;
fields = dictT.fields(false,false,true);
se = fields.getEnumerator();
while (se.moveNext())
{
dictF = se.current();
log.logField = dictF.id();
log.insert();
info(strFmt("Adding field %1", dictF.name()));
}
SysFlushDatabaselogSetup::main();
}
Subscribe to:
Post Comments (Atom)
The article you have shared here very good. This is really interesting information for me.
ReplyDeleteMS Dynamics Trade and Logistics Online Training
Microsoft Dynamics Operations Trade and logistics Training
Microsoft Dynamics operations Trade and Logistics
MS Dynamics Trade and Logistics Training
MS Dynamics Operation Trade and Logistics Training