An update conflict occurred due to another user process deleting the record or changing one or more fields in the record

Hello,

In our TEST environment, when posting an AP/Invoice journal it is throwing the below exception

Cannot edit a record in Journal lines (LedgerJournalTrans).
An update conflict occurred due to another user process deleting the record or changing one or more fields in the record.

The TEST was refreshed a couple of weeks ago and it had been posting the journals with no issues. It started recently and we have the journals getting posted in production as usual as of now. We could have our TEST refreshed one more to further continute with our testing but just curious to see what exactly may be causing the issue in our TEST. Any inputs is appreciated.

Thanks!

Is there a custom code while posting the journal? (if custom code causing this issue, calling tablebuffer.reread() will be a fix)

The error says that the code is trying to update a record that is been updated by another process but the current process is unaware of it, means code is trying to update an older version of the record. You may have to debug and see the reason for conflict (try adding a break point to update method of ledgerJournalTrans).

It may be a different scenario (in terms of code execution), that is causing the update conflict.

Hi dave,
restart the axapta service then post the journal…

Thanks Kranthi.

I had tried the tablebuffer.reread() but it is making the code to rerun again and throwing an error/message that the record already exists in the ProjCostTrans table. Calling a reread() method on the table definite may be a solution and I might be doing something wrong at the same time. However, to make this simple and avoid the confusion I just created a local buffer for the LedgerJournalTrans and selected the record based on the current LedgerJournalTrans.Recid and then updated the local buffer has solved the issue. Which looks something like this

select firstOnly locLedgerJournalTrans where locLedgerJournalTrans.RecId == _ledgerJournalTrans.RecId;
locLedgerJournalTrans.selectForUpdate(true);
//_ledgerJournalTrans.reread();
locLedgerJournalTrans.DefaultDimension = projCostTrans.DefaultDimension;
locLedgerJournalTrans.doUpdate();

Why would calling reread() on ledgerJournalTrans will insert a record in ProjCostTrans? That is something you have to investigate. Try by adding a break point to ProjCostTrans.insert() method.

Your solution is OK. I would rather suggest you to use \Data Dictionary\Tables\LedgerJournalTrans\Methods\findRecId instead of new select.

How to restart axapta service, could u pls help out?

Hi, the service to restart is on your AOS server

Hi Everyone,

So I am new to this field and I need some urgent help.
I am getting this error on production and not on test server.
what can we do in order to solve this issue.

FYI: We are working on-prim D365FO and I tried manual DB sync but it didn’t solve anything.