Kernel error!? Optimistic concurrency works incorrectly!

IMikhaylovIMikhaylov Member Posts: 4
When two users try to modify the same record in the same table, Navision inform you about error "Another user modified this record... bla bla". It's all right. But if there is some code on trigger OnValidate of the field, from which you modify the record, and this code makes some modifies in other tables, Navision doesn,t put transaction back and saves all modifyes in other tables. But changes in the modified record will be put back. :shock:

This error appears in Navision of all versions, workink with MS SQL Server.

Who met this problem and knows how to solve it, help please.

Comments

  • ara3nara3n Member Posts: 9,257
    So are you expecting this to work this way? when you validate a field and it runs some code that modifies 50 other records to lock those records. while you still on that record, and the data should be commited when you go to the next record?


    Here is a suggestion. It's not a good one, but onvalidate of the field add a modify(true); That way the record is saved. and if somebody else modified it will role back.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • SeerSeer Member Posts: 1
    BlackTiger wrote:
    (sorry, in russian)

    Прежде чем панику поднимать, неплохо бы было для начала поTRTFM-имть и обратится к специалистам.

    (back to english)

    Navision doesn't puts changes immidiately to improve performance. Engine just locking thise records to prevent modifucation by other users. Remember, Navision trying to emulate versioning ontop of SQLServer's locking. This isn't easy job. Remember one more thing - Navision isn't native SQLServer-oriented application.

    Navision caches updates and putting them into database only on COMMIT.

    All what you need - just lock tables correctly.

    This trouble is described in detail here (in russian):
    http://forum.mazzy.ru/index.php?showtopic=5487
  • IMikhaylovIMikhaylov Member Posts: 4
    Here is example to make it clear:

    We have two tables. On some field of the first table there is code, which inserts records in the other table. There is no COMMIT in this code!

    1. First user changes the field in a record of the first table, but don't validate it.
    2. Second user, in the same time, from another Navision client changes the same record of the same table (any other field) and validates it.
    3. Now the first user validates the field, which hasn't been validated (on trigger of this field we have code, which inserts records in the other table).
    4. Navision informs us about error and doesn't make any changes in the first table. But changes in the second table (which was made from trigger OnValidate) will be saved.

    I can send objects.
  • IMikhaylovIMikhaylov Member Posts: 4
    BlackTiger wrote:
    Ok. Send me your code. I think I know what is wrong.

    I've sent you a letter with objects by E-mail (alexey_pavlov@navigator.lv).
    We tried to lock table 1, but there is no good effect ](*,) .
  • Miklos_HollenderMiklos_Hollender Member Posts: 1,598
    Actually it sometimes happens in the standard. Adjust Cost - Item Entries in 3.6 did something like validate some field (I think Unit Cost) in the Item and then the OnValidate wrote something (Standard Cost, maybe?) and it resulted in the "another user has modified" error. I think we solved it by putting a MODIFY in the code somewhere. Don't really remember, was long ago.
Sign In or Register to comment.