Manage Learn to apply best practices and optimize your operations.

Restrict Editing On Certain Fields

This script is used in the Entering event of the field. Even if a user has
manager access to the database, he won't be able to edit the field if it isn't
meant to be edited. With this code the allowable editor won't be able to edit
the field unless that status is at certain values. I used this for some dollar
fields that are entered by a user and can not be changed by anyone else, they
can not even be edit by the user unless the document is new, in draft, or has
been rejected by the manager.
Few notes: On the form are two hidden fields one is computed when composed and
is the document creator, this is the OrgName field. The other fields is
computed this is the current editor of the document, the field is CurrentName.

Sub Entering(Source As Field)
Dim UIDoc as NotesUIDocument
Dim Workspace As New NotesUIWorkspace
Dim Session as New NotesSession
Dim StatusVal As String
Dim CurrentEditor As String
Dim OrgEditor As String

Set UIDoc = Workspace.CurrentDocument
'Get the status of the current doc
StatusVal = Trim(UCase(UIDoc.FieldGetText("Status"))
'Get the name of the doc creator
OrgEditor = UIDoc.FieldGetText("OrgName")
' Get the name of the curr. doc editor
CurrentEditor = UIDoc.FieldGetText("CurrentName")
If UIDoc.IsNewDoc Then
'Allow field to be edited
'If the curr. edit is the creator check the doc status
Elseif OrgEditor = CurrentEditor Then
If StatusVal = "DRAFT" Or StatusVal = "REJECTED BY MANAGER" Then
'Allow field to be edited
'if the status is something else force the cursor to go to
another field.
'If current editor is not the creator then
force the cursor to go to another field.
End If
End Sub

Dig Deeper on Domino Resources - Part 4

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.




  • iSeries tutorials'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 ...