Manage Learn to apply best practices and optimize your operations.

Prevent save conflicts over the Web

This code will provide you with way of preventing save conflicts on the Web.

View member feedback to this tip.

This code will provide you with way of preventing save conflicts on the Web. I am not sure if somebody already published a similar tip, but I was looking for ways of preventing save conflicts on the Web and didn't find much. This code is in Java, but you can do the same using LotusScript.

In the webQuerySave agent I have created
 a method to check for conflicts ($Conflict) field. 

public boolean isSaveConflict(Document doc) 
boolean isSaveConflict;
if (doc != null && doc.hasItem("$Conflict"))
isSaveConflict = true;
isSaveConflict = false;
return isSaveConflict;
catch (NotesException ne)
return true;

So if isSaveConflict method returns
 true I call another method 

public void 
processSaveConflict(Document doc)
 throws Exception {

// create new field called oldform where 
you store original form name for the reference
doc.replaceItemValue("OldForm", doc.Form); 
// replace Form name to (for example)
doc.replaceItemValue("Form", "SaveConflict"); 
// remove $Conflict field
// remove $REF (save conflict is 
a child doc to the original)

// So if the save conflict is detected 
you can create an error page where you 
inform the user that the save conflict 
occurred and the document hasn't been 
saved, or you just print the message 
about save conflict.
You can provide a go back button 
where you open original document. 

The agent can send an e-mail 
notification about save conflict.
I also created a view where all 
save conflicts can be checked 
(the form name is SaveConflict).


The technique provided here will detect conflicts, but not prevent them. What will happen when conflict arises after this test condition is passed and while saving the document?

—Dhanasekar D.


Well, you are right, it doesn't prevent the save conflicts. What it does is remove relation between original document and the save conflict (so you don't see it within the view) and notify user about it, so the user can try to save changes again. As far as I know, the only way to prevent save conflicts is to lock document, but this has its disadvantages too.

—Robert Ficek, tip author

Do you have comments on this tip? Let us know.

This tip was submitted to the tip exchange by member Robert Ficek. Please let others know how useful it is via the rating scale at the end of the tip. Do you have a useful Notes/Domino tip or code to share? Submit it to our monthly tip contest and you could win a prize and a spot in our Hall of Fame.

Dig Deeper on Lotus Notes Domino Agents

  • Favorite iSeries cheat sheets

    Here you'll find a collection of valuable cheat sheets gathered from across the iSeries/ community. These cheat ...