Bojensen Blogs

Setup DB Logging in X++ (Updating events) | Explore AX.com

Setting up AX Database logging via the user interface wizard can at times be a bit of a cumbersome and slow task, especially for tables that are not very common.

The job below will simply set database logging for all fields on a specific table. Simply replace “InventSalesSetup” with the table name of your own choosing.

As always, test this in a non-production environment to confirm that it performs suits your own needs.

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(); }

Setup DB Logging in X++ (Updating events) | Explore AX.com

Comments are closed.