Dear All,
I have a client which is having an issue where two users would be accessing the same record and one ends up losing information. Basically the below scenario:
User 1
User 2
Opens Order
Edit Line 1
Opens same order
Go to Line 2
Line 1 updated with User 1’s changes
Modify Line 2 ---Modify Line 2
Go to Line 3 :: Successfully Updated
Go to Line 3 :: ERROR - Another User has modified the record..
The client is requesting that when two users would be accessing the same record (in the above example, both are modifying line 2 concurrently); the users will get a notification that there’s another user modifying the same record.
Do you think the above is possible? I’ve tried keeping the USERID of the user but can’t save it OnAfterGetRecord Trigger
Thanks in Advance!
Comments
On the sales order Subform (sales lines) the pages are setup with the property "DelayedInsert".
This basically means when user 1 starts changing the record the record will not be saved until he/she moves to a next line.
At this stage the system will check what is already in the database if it is not the original record you will get the error message from your post. In more detail
User 1 opens the line and reads "first line".
User 1 changes this text into "test".
In the mean time User 2 changed the line to be ''user 2 line'.
When User 1 moves to the next line the system will try to save the record, anyhow it will notice that xRec and also REc are different "first line" <> ''user 2 line" and "test"<> ''user 2 line". hence system reports the error message from your post.
It is just a thought, as I never tried this, but If you check on insert trigger xREc and REc this may provide what you want to achieve.
If the property "DelayedInsert" is not selected then system behaves differently.
The record will be saved as soon as the primary key is populated.
I hope this helps.
I was more after saving a boolean/usercode in the sales line record (not sure where to put the code though) and then clear the value when the user moves away/to another record. This field will be filled in with 'user1' and when a different user accesses the same record it just pops-up that the record is already being accessed by another user. any suggestions pls?
Thanks again!
Do not try to change this behaviour, No is a powerfull answer for requests like these.
Microsoft Dynamics NAV
A transaction must be started before changes can be made to the database.
Page Edit - Sales Invoice - ##. must close.
OK
I'm not seeing a solution to this.
Will try to re-explain to them.
Thanks!
I would agree with Mark on this.
Anyhow there is also another option that would work.
You create a new Page or Form based on a temporary table.
When a page or Form is opened you pull data from the table and populate the page or form.
A user can now change the data in the Page/Form.
As we use a temporary table the records are separated between users.
When the page is closed (or you can create a Save button) the system compares the entries in the temporary table with the data in the real table. Additional you save the data in the real table.
If you see the two records are different, you show an error message or confirmation message, reporting who is going to overwrite changes. You can even create a History table with information at what time the record was updated inserted or changed.
I hope this helps.
Thanks and Regards!