Do you have any idea on how to avoid this error?
"Another user has modified the record for <table name> <primary key> ' pk record value' after you retrieved it from the database"
When I'm using SQL Server, i never come up with this error when executing my code. But when I run it using Navision Database Server, I end up having this error. Do you have any possible resolution on this? [-o<
Thanks!
0
Comments
2) If it is problem only sometime and when there are more users on the DB, it is common, if the tables are not locked. (for example two users are editing same order header etc.)
You need to analyze this from this point:
a) When it is happen
b) If allways in same process, independent if there are more users, it is problem of C/AL code. Than you can use Client Monitor to catch the points where is the table (record) modified and analyze the code
c) If it is problem only sometime, if there are another users working with the table, it is common...
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
You run the code below here, you take a record and it has version 1.
You launch a function that takes THE SAME RECORD WITH THE SAME VERSION (=version 1).
You change the record in the function and save it. When saving, Navision controls if the version in the variable is the same as the one in the DB and in this case it is the same, saves it AND CHANGES THE VERSION (=>version 2!
Now in the calling part you change the same record that still has version 1!
Save it, Navision checks and sees that the variable is version 1 and the DB is version 2=> ERROR!
You should do a recMyRecord.FIND('='); after the function to get version 2 of the record.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
RIS Plus, LLC
Assuming Table1 and Table2 are record variables of NAVTABLE; the GUIDs have different values.
IF Table1.GET(sampleGUID) THEN BEGIN
Table1.Field1 := TRUE;
Table1.MODIFY;
IF sampleGUID2 <> sampleGUID THEN BEGIN
CLEAR(Table2);
IF Table2.GET(sampleGUID2) THEN BEGIN
Table2.Column2 := 'value2';
Table2.Column3 := 'value';
TrimOtherRecordValues(); //only trimming records but not saving
Table2.MODIFY;
END;
END;
END;
When the table2.Modify was invoked, the error occurs. In this way, I want to modify two records in one table. Do you know how to resolve this?
By the way, what does recMyRecord.FIND('=') do?
I have used this in my other functions but I guess i dont need this in this given scenario. thanks
FIND('=') is like GET,but the primary-key-fields must have been filled up in the record.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
And the filters are used (get is ignoring filters)... 8)
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
RIS Plus, LLC