"Object variable not set" error on LotusScript NotesUIWorkspace.CurrentView

Hello,

Previously we were using Domino Server 6.5 and Notes 6.5. Right now we are using Domino Server 8.5 and Notes 8.5.

We wanted to do some custom processing on selected email(s) of Note’s Inbox. We created a new Toolbar inside Notes and added one button on it. The formula on button’s click opens a Page. In Page’s postOpen, we have written LotusScript to get selected documents (emails). Following is the LotusScript. Values for variables Server$, FilePath$ and View$ were passed from button’s formula to Page.

-------LotusScript-------------------

Dim DocCol As NotesDocumentCollection

Dim WO As New NotesUiWorkspace

'Msgbox "Server " & Server$ 'CN=LotusDev/O=unfccc

'Msgbox "Filepath " & FilePath$ 'mail\ceadmin.nsf

'Msgbox "View " & View$ '($Inbox)

Call WO.OpenDatabase(Server$, FilePath$, View$)

'Following line gives error “Object variable not set”

Set DocCol = WO.CurrentView.Documents

Msgbox “Last line” 'This is not printed


We are getting an error on WO.CurrentView.Documents line.

The same code works on Domino Server 6.5.

Please guide me if things have been changed in Domino server 8.5 or if we are missing something.

Thanks in advance.

Subject: NotesUIWorkspace.CurrentView

I am not sure if this will help but you may want to consider that the Inbox is a Folder, not a View. I have not attempted what you are doing so I cannot write code for you but you did say that a click on a button took you to a Page where your code was run on PostOpen, therefore the CurrentView property that you call on is Nothing. It would work as part of a View action button but not from a Page - there is no CurrentView on a Page.

Subject: Old (v6.5) ID file vs upgraded (v8.5) ID file

Thanks for your reply.

Well let me tell you history behind this error. As I mentioned earlier, we were using Domino Server 6.5 and Notes 6.5.

Our goal was to create .dxl files of selected email(s) of Inbox.

To accomplish this, we created new tool bar and then a button on it. The formula on this button was as follows:


@SetEnvironment(“UI_DBServer”;@Subset(@DbName;1));

@SetEnvironment(“UI_DBFilePath”;@Subset(@DbName;-1));

@SetEnvironment(“UI_View”;@Subset(@ViewTitle;-1));

@URLOpen(“notes://LotusDev/08257666003BB4D6/testCapture?OpenPage”)


When user selects email(s) from Inbox and clicks on the button, we were calling testCapture page as you can see above. On this page, we referenced (using %INCLUDE) and then used Script Library. We passed three arguments (UI_DBServer, UI_DBFilePath and UI_View as you can see in Formula above) to this Script Library class. The Script Library returned collection of documents. The remaining code on this “testCapture” Page was to create .dxl file for each document of the document collection retrieved from Script Library. The actual source code of this Script Library was inside one .lss file and was hidden (we could not view/edit this .lss file). One consultant wrote this code for us. Everything was working fine and we were able to create .dxl file(s) correctly for each selected email(s).

Then we upgraded Lotus Domino Server from 6.5 to 8.5 FP1 and Lotus Notes from 6.5 to 8.5 FP1. We also upgraded some user ID files to work with 8.5 Domino Server. However, there are few user ID files which we did not upgrade to 8.5.

The problem - when we log in to the Notes using upgraded user account (ID file v8.5), we are getting “Object variable not set” error when we clicked on the button.

Interesting - when we log in to the Notes using old user account (ID file v6.5), we are not getting any error when we clicked on the button. Everything works fine as before.

We contacted the consultant who wrote that Script Library (.lss file). He then provided us new script and we deployed it on Domino Server. We still got same error while using Notes with upgraded user acount (Id file v8.5). This time, we had access to actual source code of script and we found that line NotesUIWorkspace.CurrentView.Documents gave this error. The consultant claims that old script (hidden .lss file) and new script are same. The new script also takes three (same) arguments as old script did and returns collection of documents.

I would like to know - what are the differences in ID file of v6.5 and ID file of v8.5? Why does using the former work fine and later doesn’t? What exactly happen when we upgrade ID file?

Are there other ways to work on “selected” email(s) of Inbox folder? We found that using @NoteID in formula we can process/work on “single selected” email. But what about processing multiple selected emails?

Any help would be appreciated.

Thanks!

Subject: Options

I can only assume you are using a toolbar button because you cannot make changes to the mail template. I would need to see the code in the script library class however it’s an odd one when it works or fails depending on the notes version of the id file. Weird eh, sorry don’t know that one. There are probably several ways to do what you want though that should not depend on the ID file.

Can your user’s create personal agents? Once again I am assuming you can’t make a change to the mail file/template.

On the surface it seems straight forward enough. A user selects documents by ticking them in the selection column. The code should subsequently work on the selected or ‘Unprocessed’ document collection to do what you want.

I am not sure why the process involves using formula to get variables and then pass them to a Page where lotusscript takes over. This is probably a limiting business requirement you may not be free to talk about here.

The ‘NotesSession’ object will know what the server and current database is. The ‘NotesDatabase’ object will know what the ‘UnprocessedDocuments’ are. Your script class may already be doing this, I don’t know. Quite often a solution will depend on the outlook and experience of the developer. Just about where ever I end up contracting I see another way of doing something.

You can email me if you like: bruce dot langner at gmail dot com