Transaction Log - AX 2012 - Cannot create a record in Audit trail (TransactionLog)


 If you got the following error you might have for problems in the system sequence table.


 Just run the following in SSMS:



select * from SYSTEMSEQUENCES where id = -2

 and then

select * from TRANSACTIONLOG where CREATEDTRANSACTIONID > returnedID order by CREATEDTRANSACTIONID asc


 If you have any records returned by the second statement then you should look into why you have a lower system number saved.

1 comment:

  1. Hi

    I have resolved the same issue in AX 2012,
    To over come this issue, please find the below code modifications in Tables-->TransactionLog-->Methods-->create.
    The existing Code:

    if (appl.lastTransactionIdCreated() != appl.curTransactionId())
    {
    transactionLog.Type = _type;
    transactionLog.Txt = _txt;

    transactionLog.insert();

    appl.lastTransactionIdCreated(transactionLog.CreatedTransactionId);

    appl.transactionlogUpdateTTSControl().revoke();
    }



    The changes to make:

    if (appl.lastTransactionIdCreated() != appl.curTransactionId())
    {
    if (!TransactionLog::find(appl.curTransactionId()))
    {
    transactionLog.Type = _type;
    transactionLog.Txt = _txt;

    transactionLog.insert();

    appl.lastTransactionIdCreated(transactionLog.CreatedTransactionId);
    }
    appl.transactionlogUpdateTTSControl().revoke();
    }

    Regards
    Pavan

    ReplyDelete