Manage Learn to apply best practices and optimize your operations.

Prevent users from editing through the UI

How to allow a user to modify a document without having them change it by putting it in Edit mode.

View expert feedback to this tip.

There may be occasions where a user needs to be able to modify a document but you don't want them to change it by putting the document in Edit mode. This method requires changes to an action button as well as two form events.
In the Form Globals Declarations,
 add:
Dim EditAction As Variant
 
Then, in an Edit action button:
Initialize event:
EditAction = True
Terminate event:
EditAction = False
 
The Click event can contain checks
 to enable certain users to switch to 
edit mode (by setting NotesUIDocument.
EditMode = True) and/or messages
 regarding how to change the document.
 
Sub Queryopen(Source As 
Notesuidocument, Mode As Integer, 
Isnewdoc As Variant, 
Continue As Variant)
If Not Isnewdoc Then
 If Source.EditMode Then
  Messagebox "This document cannot 
be opened in Edit mode",16,"Edit 
Document"
  Continue = False
 End If
End If
End Sub
 
Sub Querymodechange(Source As 
Notesuidocument, Continue As Variant)
If Not EditAction Then
 Messagebox "You must use the Edit 
action button to edit the document",
64,"Edit 
Document"
 Continue = False
Else
'An alternate place for code that allows 
certain users to edit. To disallow edits, 
make Continue = False
End If
End Sub

EXPERT FEEDBACK TO THIS TIP


This is not really secure. The only guaranteed secure way to control who can edit a document is to use Authors fields. There are several ways to bypass this LotusScript control. The simplest is to write an agent or smarticon formula to assign whichever fields you want to assign. Anyone with Domino Designer can also use the LotusScript debug mode to prevent execution of this code (start to debug it and click "Stop").

Considering that the stated purposes of this edit action button could be better satisfied using an Authors field (if the idea is to only let certain users edit) and/or by putting message boxes in the Querymodechange and Queryopen code (if the purpose is to display "messages regarding how to change the document").


Do you have comments of your own? Let us know.

Dig Deeper on LotusScript

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close