Yesterday I got a mail from one of the Notes developer from Notes Forum with below contents :

We recently upgraded our Notes environment from R5 to R7 and currently running to an issue with one of my workflow database. I have an 'Author' field which capture names, date and time when users approve/validate a request. This field stop working since when users validate requests with R7 Client.. If users approve a request with R5 Client, their names appear in the field.


I'm using the following code in the Terminate Event of the "Author" field. When users approve a requests, the approver name, date and time supposed to be appended to this field but it's blank now. Can you please help me modifying the code?


Sub Terminate
Dim workspace As New NotesUIWorkspace
Dim session As New NotesSession
Dim uidoc As NotesUIDocument
Set uidoc = workspace.CurrentDocument

Author = uidoc.FieldGetText ("Author")
RevApproval_a = uidoc.FieldGetText ("RevApproval")

If Author = "" Then
If RevApproval_a <> "" Then
Author = "Completed by " & session.CommonUserName & " on " & Format(Now(), "Long Date")
Call uidoc.FieldSetText ("Author", Author)
Call uidoc.save
End If
End If
End Sub


I don't have R5 client So, I was not able to test the code.But tested in R7 and it was not working (Can't check in debugger also because it doesn't work in Terminate event).When I analyze the code , I don't find anything wrong with that.In jiffy I modified the code and send back to that person , Since it was urgent request.My code was -

Dim workspace As New NotesUIWorkspace
Dim session As New NotesSession
Dim uidoc As NotesUIDocument
Set uidoc = workspace.CurrentDocument
Dim doc As NotesDocument

uidoc.EditMode=True
Set doc=uidoc.Document

If doc.GetItemValue("Author")(0) = "" Then
If doc.GetItemValue("RevApproval")(0) <> "" Then
Call doc.ReplaceItemValue("Author","Completed by " & session.CommonUserName & " on " & Format(Now(), "Long Date"))
Call doc.Save(True,False)
End If
End If

After replying him, I thought to analyze the code and something has instantly strikes in my mind "Will NotesUIdocument works in terminate event?" I have tested his old code in some other event and it worked as he expected.It was very small thing , But skipped from my mind :(

Further more I thought to dig something more about Notes events, I found something useful for those who always skips small things , like me :)

* You not use Initialize for anything except agents, and not use Terminate at all

* Each object has a Declarations area where you can write non-executable statements that apply to all events in the object, and an Options area for statements such as Option, Use, UseLSX, and Const. Each document and view has a Globals area where you can write non-executable statements that apply to all objects in the document.

* Changes made to the current document in a PostOpen event are treated as default values. The document is not marked as changed. If the user closes the document at this point, the PostOpen changes are lost. You must explicitly save the changes, for example, with the Save method of NotesUIDocument, if you want to be sure they are applied.

But still a question, how to debug your code which is in "Terminate" event ?
I think only way "MSGBOX" :) , Anything else you guys know ?

Author -> billbuchan

Okay. This isn't a coding tip, per say, but will be of most use to developers.


A common scenario, in order to rein in the developers, is to have a separate development environment, where the developers can crash servers to their hearts delight. (Being a developer, this is one of my few job-related joys).


However, there usually is (and certainly should be!) a separate certification hierarchy.

Some people might choose to use "file, tools (or security..they keep moving it!), switch ID", or might even go to the lengths of making custom location documents - one for their "production" ID, and one for their "development" ID.


This is bad:

  • You keep having to switch between environments.
  • You risk attempting to use the wrong ID in the wrong environment
  • You start getting certificates bleeding through your names. nsf (personal name and address book).

All of which are bad.


So - the solution ?


Create separate notes client data directories, and have separate notes.ini files (usually placed in the data directory) for each environment. Then use:


nlnotes.exe =


to start them up on a desktop icon.

For instance, I have:


C:\Lotus\Notes6\nlnotes.exe =c:\notes\data\notes.ini


to start up my production client.

You can then have multiple clients running on your machine, oblivious to each other.

The environments need never see each other. And you can continue doing useful stuff in both clients.


Okay - different versions. How about your production environment is v5, and your test is v6 ? Or the other way around ?


Simple - install the notes Executable client in separate directories, and use the same trick.


But does it work ?

On a good day, I have:
  • One notes and developer 4.6.7 client (dont ask)
  • two notes v5.0.12 clients (development and test of tooling)
  • three notes 6.0.1 clients (production, personal, and v6 app development)


All open at the same time.


So - no excuses. Separate directories, separate clients. Easy, simple, fast, productive. So what are you waiting for ?

preload preload preload