Another user has modified the record

Wxyz1234
Member Posts: 4
Hi !
We have an Update trigger to catch up records of few fields from Sales line table to another table being with another DB.
But that leads to error in Navision postings, like the below,
How to overcome this error??
Thanks !
We have an Update trigger to catch up records of few fields from Sales line table to another table being with another DB.
But that leads to error in Navision postings, like the below,
Another user has modified the record for this Sales line after you retreived it from the database. Enter your changes again in the updated window, or start the interrupted activity again.
How to overcome this error??
Thanks !
0
Comments
-
But are you changing fields in the sales line? This changes the version of the record and thus NAV says that the record has changed. You should avoid writing in the sales line to avoid the error.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
kriki wrote:But are you changing fields in the sales line? This changes the version of the record and thus NAV says that the record has changed. You should avoid writing in the sales line to avoid the error.
Hi ! Thanks for ur reply,
But i am not writing into sales line, Jus picking up the values from the line at the time of the line getting updated and storing those to a another table.
The error occurs only when the header getting changed and affects the lines and not when the row gets changed individually.
Like, when the the Delivery date on header gets changed , it asks for update over rows, by this time alone the error occurs.
Where as when the row delivery date is changed manually row by row the error is not appearing.
Any guess??0 -
I've seen the problem a lot of times.
Probably this is happening:function1: LrecSalesLine.GET(...); // you get the record (it is version 1 now) Function2(LrecSalesLine); // you call another function giving this record as a parameter LrecSalesLine.modify; // you modify the line. NAV checks if the record in the DB is still version 1 and it is NOT because in "Function2" you just changed the version
Function2 (IrecSalesLine) // you have NOT toggled the VAR for the variable, so it makes a copy of the buffer ... IrecSalesLine.modify; // you modify the line. NAV checks if the record in the DB is still version 1 and it is, so it writes the new version. in the DB there is now version 2
Solutions:
Or you put the VAR-toggle in Function2 if that is possible
Or after calling Function2, you refresh the record, doing a GET or a FIND('=')Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Hi !
But i do have the Triggers in SQL in Sales Line Table...
I am not aware of NAV C/AL codes... Seems u ve mentioned it for C/AL code ...
is there a similar way to do it in SQL ?
The Trigger looks like,
Update Trigger looks like,Alter Trigger [UpdatingRows] on <Company Name>_$[Sales Line] as If Exists (Select No from Inserted Where docTYpe = 1 and Status = 0) Begin Update BackUp.[dbo].[SalesLine] Set UpdateDate = GetDate(), ProdNo = inserted.No End
Thanks !!0 -
Did you try everything WITHOUT the SQL-trigger? At first sight, the trigger should not give problems.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
-
I was advised by someone (Rashed?) years ago to use a cursor in the for update trigger, that way the timestamp field is not modified.
This worked for me in version 4 SQL 2000, so give it a try.
The regular read in the update trigger apparently updates the timestamp field in the table which is why you get the message.David Machanick
http://mibuso.com/blogs/davidmachanick/0 -
Hi
did you find any solution to your problem? How should I use sql cursor to make this work ?0 -
Dear,
This also happening on me last time we use trigger to update another record from sales line,
because like kriki said those running trigger have different version of modify record which can
cause locking on timestamp which is always updated when Sales Line record updated or modify
from NAV Service. i suggest that you use Predefined Event on Table Sales Line without touching
SQL Server side.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