Manage Learn to apply best practices and optimize your operations.

Using Script Libraries

I had created two forms which i only wanted to be editable by the users of the
role [Keys] which i created in the acl . By putting the the code below in a
Script Library ( which i named "Access1" ) i only had to write it once , if i
had more roles i could of passed the role as a parameter as well but this was
not required .

To use the below code in a form go to the declarations and type

Use "Access1"

this allows use of the scripting library .

then you can call the procedures in the scripting library .
In my case i used it in the form procedure querymodechange as follows

Sub Querymodechange(Source As Notesuidocument, Continue As Variant)
' See Script Libraries - Access1 and the procedure checkaccess for details
Call checkaccess(Source ,Continue) ' check to see if the user is allowed
to edit the document
End Sub

I Know there is other methods of doing this but for what i wanted it suits fine
and demonstrates the use of script libraries .

Any comments -
e-mail me at
Option Public
%INCLUDE "lsconst.lss"

Sub CheckAccess(Source As Notesuidocument, Continue As Variant)
' The purpose of this code is to only allow users with access to the [Keys]
role to exit the document
' Written by Garreth Kelly Feb 2000
Dim db As NotesDatabase
Dim session As New NotesSession
Dim acl As NotesACL
Dim Entry As NotesACLEntry
Dim newName As String
boxType& = MB_OK 'Constant from the file lsconst.lss - value of MB_OK =
0 , the file lsconst.lss is declared in the from global of xLookup .
Set db = session.CurrentDatabase
Set acl = db.ACL ' get the current databases access control list
newName = Cstr(session.UserName) ' returns the current user logged on
Set Entry = acl.GetEntry( newName ) ' get the users entry in the acl
On Error Goto Err1
If Entry.IsRoleEnabled( "[Keys]" ) Then ' check to see if the user is part
of the role [keys]
Continue = True
Continue = False ' the user isn't part of the role don't allow access
to edit the document
Messagebox "You don't have sufficient access to edit this document",
boxType& ,"Error:"
End If
Exit Sub
Continue = False

Messagebox "Unknown Error", boxType& ,"Error" ' this message will appear
if the currently logged on users name is not in the nab .
End Sub

Dig Deeper on Domino Resources - Part 7

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 ...