How can i get rid of the error.

Jacob1227
Member Posts: 128
Hi All,
I have tried to change the sales order from codeunit.In that time i am getting the below error.
Microsoft Dynamics NAV
An attempt was made to change an old version of a Sales Header record. The record should first be reread from the database. This is a programming error. Identification fields and values: Document Type='Order',No.='1221'
OK
Can you please suggest me some steps to resolve this error.
Thanks in advance,
Jacob.A
I have tried to change the sales order from codeunit.In that time i am getting the below error.
Microsoft Dynamics NAV
An attempt was made to change an old version of a Sales Header record. The record should first be reread from the database. This is a programming error. Identification fields and values: Document Type='Order',No.='1221'
OK
Can you please suggest me some steps to resolve this error.
Thanks in advance,
Jacob.A
0
Answers
-
This happens when you change the database record using two or more record variables. I don't understand all conditions, but the following triggers the error in my test environment (NAV 2018 CU 5).
r1.GET; r2.GET; r2.value := 2; r2.MODIFY; COMMIT; r1.value := 1; r1.MODIFY; // Causes the error
Even moving the assignment r1.value := 1 before the r2.GET prevents the error. Also removing the commit prevents it. Does NAV do some outOfOrder processing or copy on modify caching?
So, I am confused about the details (has someone more insight?), but the general pattern is- read the record
- modify the same record using a different instance of the record
- modify the record
0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions