How to temporary disable database log?

Hello,

I am using AX2009.

I setup a database log rule on table custTable - for event update.

Now I need write a job to mass update many records on custTable.

How can I temporary disable the database log?

Hi Kenl,

You can disbale the database logging by calling the skipDatabaseLog() method on the table buffer and passing tru to it.

So your code will be,

custTable.skipDatabaseLog(true);

custTable.insert();

Hi,

If you want to do bulk insert, you have to prevent the check which determines whether the table´s insert() method has been overridden. If this is not done and the table’s insert() method is overridden, then the insert will be downgraded to normal table insert.

This check can be disabled by calling -

.skipDataMethods(true);

The above code will skip the insert method override. Obviously the risk by doing this is - any business logic implemented by table’s insert() method will not get executed. Therefore due diligence is required.

Thank you very much. It works.

Hi,

I write Job below, but Error : Lot ID not specified.

static void restoreDeletedPO(Args _args)
{
PurchTableDelete purchTableDelete;
PurchLineDelete purchLineDelete;
PurchTable purchTable;
PurchLine purchLine;
;
purchTableDelete = PurchTableDelete::find(‘PO018059’, true);
ttsbegin;
switch (purchTableDelete.Cancelled)
{
case Voided::Voided :
purchTable = conpeek(purchTableDelete.PurchTable, 1);
purchTable.skipDatabaseLog(true);
purchTable.insert();
while select forupdate purchLineDelete where purchLineDelete.PurchId == purchTableDelete.PurchId
{
purchLine = conpeek(purchLineDelete.PurchLine, 1);
purchLine.skipDatabaseLog(true);
purchLine.insert();
}
purchTableDelete.delete();
break;
case Voided::linesVoided :
while select forupdate purchLineDelete where (purchLineDelete.PurchId == purchTableDelete.PurchId)
{
purchLine = conpeek(purchLineDelete.PurchLine, 1);
purchLine.skipDatabaseLog(true);
purchLine.insert();
purchLineDelete.delete();
}
purchTableDelete.delete();
break;
}
ttscommit;
}

Thanks

Debug and find whether InventTransId in PurchLine is getting properly updated or not?

Thanks so much

Let me try and let you know.

Regards