Global Variables Lost in Notes 6.0.1

I found a very astonishing error that is new under Notes 6.0.1: Under certain circumstances, global variables pointing to objects loose their content during a uidocuments lifetime.

I created a small database (260kB) which demonstrates the error. The database can be found here:

http://www.foconis.de/foconis/website.nsf/da8af0043983d4e4852566ac007208b5/abddcdebeca3d888c1256ced005fe474!OpenDocument

If you want to reproduce the Error, you need the following ingredients:

  1. A script library (Lotus Script) that declares a public global an object variable (called ses in our case). The variable is instantiated during the Initialize section of the library by doing a “set ses = New NotesSession”

  2. A form that uses the library (use “Library” in the “Globals” section of the form) and the contained global variable “ses” to print the user’s name during QueryOpen, PostOpen and QuerySave: (Print ses.username)

  3. An Lotus Script agent to get the document that is selected within a view (via session.currentdatabase.unprocesseddocuments.getfirstdocument) and edit it (via uiworkspace.editdocument)

  4. A view with two actions that call the agent. One action calls the agent using @Command([ToolsRunMacro];“Agent”), the other calls the same agent by using simple actions.

I have tested this under Win32 with Notes 4.5.7 german, 5.08 german and intl. english, 6.0 german and intl. english and in any version, both actions work without any problem: The document can be edited and saved without any problem, the username get displayed during the events.

In Notes 6.0.1 english, the action that uses the simple script causes an “Object variable not set” error when saving the document you have just edited.

A further investigation showed that the global variable “ses” becomes nothing without any reason after the Postopen event.

I have reported this to IBM/Lotus.