Saleslines on order does not update
Hey,
I'm using events to modify some of the line fields on salesorder. The event runs using codeunit. O have subscribet to onaftermodify event, and when the fields get updated the values on the page doesnt change. When i use SalesLine.modify, the values on the pages gets updated but whem i post the order i get an error saying "Unable to change an earlier version of the Customer record. The record should be read from the database again. This is a programming error". Does anybody have a workaround or solution? Thanks
I'm using events to modify some of the line fields on salesorder. The event runs using codeunit. O have subscribet to onaftermodify event, and when the fields get updated the values on the page doesnt change. When i use SalesLine.modify, the values on the pages gets updated but whem i post the order i get an error saying "Unable to change an earlier version of the Customer record. The record should be read from the database again. This is a programming error". Does anybody have a workaround or solution? Thanks
0
Answers
-
Hey juhl,
My code is following on onaftermodify:
SalesLine2.setrange(docNo, Rec.docNo)
SalesLine2.setrange(doctype, Rec.doctype)
If salesLine2.findset then begin repeat
//My statement here
SalesLine2.modify;
Until SalesLine2.next=0;
//mystatement:
The first line(Rec) is actually main item, for example ItemA. And salesLine2 are lines below itemA, that gets added when itemA is added. Those has a relation. The insert part works perfect. But when i modify some fields then the problem occurs with the text above and the order page does not update the values.
Inside the loop i calculate Qty to ship and invoice for the lines(salesline2). When qty to ship on itemA changes, salesline2 fields should also change. That is my problem now. Do you have any code example? Thanks.0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 611 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 253 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions