I have written code to automatically post the Item journal lines after it is created. The journal lines are successfully posted but I get an error that 'An Item was made to change an old version of a Item record. The record should first be reread from the database. This is a programming error. Identification fields and values:..'
Can someone suggest how should this be solved?
Use COMMIT function. so before fetching it saved in DB, and also after posting you have to call so it saved the current record.
It mostly came, when the record moved/deleted in background and, in front-end, still user open this record.
I used Commit. I still get the error. Can you please elaborate?
Could you share your code, so we can check.
Are you making any changes to the Item record during posting, you need to use a GET statement.
I am using setrange and findfirst and then posting the record.
Please send us the code
I have written code to insert data into the item journal and after that to post the inserted data.
This might guide you to solution: community.dynamics.com/.../error-an-attempt-was-made-to-change-an-old-version-of-a-sales-line-record