The Kat's Work - Blog
Main | Blog | Registration | Login
3:19 AM
Welcome Guest | RSS
Main » 2011 » June » 2 » Can't Open new NotesDocument in Frame
5:03 PM
Can't Open new NotesDocument in Frame

From discussion with others recently it became clear that we really should log lotus notes bugs. Not with IBM source of the infamous "We are aware of this problem. There are no plans currently to deal with this problem.” Somewhere that updates and workarounds can be added. In short here.

I'll try to be as objective as possible, and swear to let my blood cool before posting any.

First up, for no other reason than I came across it (again) most recently is....

The fact that you can not show a newly created document in a frame. (or editDocument ,setFrame and new notesdocument error.)

A little background to this error is that it has been present since release 5 and is still present in 8.5.

In essence the following code will not work.

Dim ws as new notesuiworkspace

call ws.setTargetFrame("NotesView”)

dim session as new notessession

dim doc as notesdocument

set doc = session.currentDatabase.createDocument
doc.form = "myForm”
doc.field1 = "1”

call ws.editDocument(false,doc)

Now it doesn't throw an error as it is valid code. It just doesn't work. Many people will ask why not use the compose method. Firstly why should we have to when this command should work (and does if we don't target a frame.) Secondly as you can see we are trying to pre-fill some fields with data (in this case field1).

Several workarounds exist:

1.use NotesUiWorkspace method compose. Get a handle to the compsed uidoc set any fields you need using uidoc methods than call a refresh of the uidoc. i.e.

    Dim ws As New NotesUIWorkspace
    Call ws.SetTargetFrame("NotesView")
    Dim uidoc As NotesUIDocument

    Set uidoc =  ws.ComposeDocument("","","myForm")   
    Call uidoc.Document.ReplaceItemValue("field1","1")
    Call uidoc.Refresh

2.Call a save of the document before calling ws.editDocument. Yes that correct if the document has been saved it works. This however is not appropriate for forms that either shouldn't be saved or or need saving at the users request.

3.Use formula on the form to fill your fields on compose, pass parameters using environment variable.

As you can see none of the workarounds are perfect. The first one is almost their but will cause some screen flicker. IBM have deemed this bug not worthy to fix in 3 whole release and countless updates. Possibly the existence of the above bodges stop them from caring. This however is a common problem in Lotus notes programming that you often come up against cases where something should work but doesn't and you must find the specifc work around for you problem.

Views: 611 | Added by: The_Kat | Tags: editDoument, Bugs, Notes Bugs, Notesdoument, setFrame | Rating: 0.0/0
Total comments: 0
Name *:
Email *:
Code *:
Login form
«  June 2011  »
Entries archive
Site friends
  • Create your own site
  • My Blog
  • Statistics

    Total online: 1
    Guests: 1
    Users: 0
    Copyright MyCorp © 2017
    Website builderuCoz