Manage Learn to apply best practices and optimize your operations.

Three steps to trap and handle save conflicts with LotusScript

Save conflicts can cause problems in Notes/Domino databases when one or more users open a document with a link. That document then opens several times in the Notes client. Use this LotusScript code to trap and handle save-conflict issues before they reach the Notes automatic handler.

Save conflicts can be a big problem in Notes/Domino databases. The conflicts usually occur when one or more users open a document with a link that subsequently opens several other times in the Notes client. Here is a three-part solution.

  1. Set up a simple view that contains all documents in the database within a single column comprised of @text(@DocumentUniqueID) and sorted in ascending order. In my example, the view is called "ByUNID."
  2. Related LotusScript resources:
    Troubleshoot agents by displaying LotusScript variables online

    LotusScript sorts lists alphabetically

    Soft-code item names to facilitate LotusScript management

  3. Use the function noConflict (shown below in code) in either the document, a script library or an .LSS file.
  4. In either the onSubmit or onQuerySave event, use the code "Continue = noConflict( Source )."

    If further processing is required, the value of "Continue" allows a developer to branch entries accordingly before exiting. For example, "If Continue = false, then exit sub."

My example is a simple No Conflicts Allowed flow. You can alert the user to the other changes using the NotesItem.LastModified property instead of the user's NotesDocument.LastModified property. You could also use this to merge the documents if the changed fields were different.

LotusScript to trap and handle save conflicts
(Click on code for enlarged view and script download.)

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

This tip was submitted to the tip library by member Jack Swalwell. Please let others know how useful it is via the rating scale below. Do you have a useful Lotus Notes/Domino technical tip or code snippet to share? Submit it to our monthly tip contest and you could win a prize.

Dig Deeper on LotusScript

  • Favorite iSeries cheat sheets

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