I inherited a database for approving purchase requisitions that I’m running into a problem with. Randomly I see duplicate records created and I haven’t been able to figure out why. When a requisition is put into the database a unique number is generated from a @dblookup. Other users are sent a link via email and they can approve / reject it. So sometime after creation I end up with 2 sometimes 3 copies of the same record with the same number and different approvers signatures are on the forms. It doesn’t happen a lot but it’s enough to frustrate me.
At first I thought it was a problem with someone using a replica of the database on a different server. I deleted all replicas so there was only 1 copy of the database but I still got duplicates. I’m running out of ideas, but there is one thing I noticed in the approval buttons of the form. The @command([FileSave]) is in the same button multiple times. Some code will get executed and then the @command(filesave) and then some more code and again the @command(filesave) and finally @command([FileWindowClose]) which prompts again to save the record. Could having multiple save events in a single button somehow be causing this?
Subject: @Command([FileSave]) and duplicate records
Multiple UI saves from one user will not normally cause a problem, but if several users all have the same document open and try to approve simultaneously, you will wind up with multiple “versions” of the same document, each approved by a different person. That’s why document locking was introduced to Notes in version 6 – but locking doesn’t do much if it’s not turned on (first tab of the database properties).
Subject: @Command([FileSave]) and duplicate records
Multiple @Commands([FileSave]) should be fine (although this leaves the question what happens in the code, that does require those multiple saves.
Are you sure, that none of the documents created are save conflicts? Depending on how the view is set up, they might not necessarily appear as save conflicts, but the presence of a $Conflict item will tell you the truth. If there are save conflicts, it could really just be that multiple reviewers opened the same document at about the same time and saved it one after another. But there could be more code e.g. in form events that affects what is happening.
Subject: RE: @Command([FileSave]) and duplicate records
So the presence of an $conflict field would tell me that there was a save conflict? What I don’t get is, I tried to reproduce what would happen. So if I have the document open for editing and someone else tries to approve they get an error message that says I have it open for editing. So it seems like Notes prevents multiple users form editing the same document at the same time.
Subject: RE: @Command([FileSave]) and duplicate records
Honestly, this can be quite confusing and I usually avoid to make definite statements in this area, but I believe, that you do not get this message, if the document was originally opened for reading, and then put into edit mode.
Subject: RE: @Command([FileSave]) and duplicate records
I see what you mean, but when I am able to create a conflict it does show up in my view as a Replication or Save conflict and includes the precense of a $conflict field.
The others aren’t doing this though, so it seems as though they’re not really conflicts. I still don’t really get what’s causing this then because I can’t replicate the duplication. If I open the document up in read mode and another user approves while I have it open and then I go to approve I get an error saying that another copy of this document was edited since I opened it and it creates a conflict file. So any how are the conflicts being made? Could conflicting versions of the client cause a problem? all client are on 6 but some are on 6.54 some on 6.52 and maybe a view other versions.