6.0.1 Bug?! NotesUIWorkspace.ComposeDocument

I have a lotus script procedure in script library where dialogbox and notesuiworkspace.composedocument are used to allow users to create a document of a different database. The program works fine in 5 but generates “Object variable not set” errors in 6.0.1. Someone posted workarounds for the notesuiworkspace.currentdocument bug. Does any one have a solution of composedocument?

In case benpoole is complainning…, the line of the code that generates the error is – Set newUIDoc = ws.ComposeDocument(…).

Subject: … (WAS: 6.0.1 Bug?! NotesUIWorkspace.ComposeDocument)

Subject: Nope… re: 6.0.1 Bug?! NotesUIWorkspace.ComposeDocument

Whenever someone reports a script bug for something buried in 100 lines of
code, they should be required to isolate the supposed bug and test for it.

The following code works like a charm under the 6.0.1 client…

[]
Dim ws As New NOTESUIWORKSPACE
Dim newuiDoc As NotesUIDocument
Dim mailDbInfo As Variant

mailDbInfo = Evaluate("@MailDbName")

Set newUIDoc = ws.COMPOSEDOCUMENT(mailDbinfo(0), mailDbInfo(1), "Memo") 
Print "Form: " + newUIDoc.document.Form(0)  'we do this to make sure we 

get a proper UIDocument handle
[
]

So whatever the problem is with your code, it would seem that the relevant
method here performs as expected.

Subject: RE: Nope… re: 6.0.1 Bug?! NotesUIWorkspace.ComposeDocument

I isolote the code to the following. I still get the “Object Variable Not Set” error. Any ideas? Thanks.

Dim ws As New NOTESUIWORKSPACE

Dim newUIDoc As NotesUIDocument

Dim db As NotesDatabase

Dim targetDB As NotesDatabase

Dim s As New NotesSession

Dim doc As NotesDocument

Set db = s.CurrentDatabase

Set doc = db.CreateDocument()

doc.pickList = “Option 1”

Call ws.DialogBox(“Dlg-Menu”, True, True, False, False, False, False, “Dialog Box”, doc)

Set targetDB = dbhandle( “OPPORTUN.NSF”)

Set newUIDoc = ws.COMPOSEDOCUMENT( db.server, db.filepath, “OPPORTUN”)

Print "Form: " + newUIDoc.document.Form(0)

Subject: RE: Nope… re: 6.0.1 Bug?! NotesUIWorkspace.ComposeDocument

What is the dbhandle function?

Subject: RE: Nope… re: 6.0.1 Bug?! NotesUIWorkspace.ComposeDocument

And also, are you sure that you can compose an OPPORTUN form manually? Possibly the error comes from its Queryopen event code.

Subject: RE: Nope… re: 6.0.1 Bug?! NotesUIWorkspace.ComposeDocument

Please use the LotusScript debugger to isolate what the name of the bad object is.

The error you get means that one of the objects (ws, db,…) is empty. If you determine what is empty…

Alain

Subject: Alas, we already tried telling him that :wink: (WAS: Nope… re: 6.0.1 Bug?! NotesUIWorkspace.ComposeDocument)

Subject: RE: Nope… re: 6.0.1 Bug?! NotesUIWorkspace.ComposeDocument

Andre is right. I got the same message when I manually compose an OPPORTUN form. The weird thing is that when I ran the lotus script debugger I don’t see the error. And when I turn off the debugger, I see the “Object variable not set” error. Even the error pops up, the form still opens.

Subject: RE: Nope… re: 6.0.1 Bug?! NotesUIWorkspace.ComposeDocument

Oooh yeah. That’s a nasty “gotcha” in Notes development.

Ages ago, I was scratching my head with some code that used the NotesUIWorkspace.EditDocument method in an r5 application. It was raising all manner of bizarre errors (which, if memory serves, differed depending on whether I was in the debugger or not)… but the one to look out for is the annoyingly-vague “catch-all” error code 4000.

In these scenarios, this usually means that the UI is having trouble with a nested event in the form used by the document you’re trying to edit. So, it sounds like your issue is a variant on that?

Subject: RE: Nope… re: 6.0.1 Bug?! NotesUIWorkspace.ComposeDocument

That’s one possibility. Another thing I always look for when I get an error I can’t reproduce in the debugger, is a script library that was modified more recently than the code that’s calling it. The debugger sort of recompiles everything in memory so that it can match code with lines; so, the debugger is not necessarily running the same code that you’re running when the debugger is off.

Use Tools / Recompile all LotusScript, and be especially on the lookout for any design elements that fail to recompile.

  • Andre Guirard
    IBM Lotus Software
    Enterprise Integration Team

Subject: 6.0.1 Bug?! NotesUIWorkspace.ComposeDocument

Hi,the problem is in the postopen event of the new doc. In this event, the current document is not the correct current document. Use the “Source”(document) which is in the parameter of the event instead of calling ws.currentdoc. This problem is still in version 6.5.

Bye