Ben Dubuc
Ben Dubuc

Reputation: 523

Simulate a form in a dialogbox in Lotusscript and update calling document

This is an issue in a Notes client application, not web app.

Classic case of a subform, opened in a dialogbox, used to enter part of the data required on the main form. The problem is that on that subform, there are links that open views (and yes, they are required) and it seems you can't open views while in a dialogbox.

So I converted my subform to a form and now what I want to do is to open that "subform" from the uidoc and bring back all values from the "subform" into the main document.

The main document is not saved. How can I get a handle on the "opening" document from the "subform" so I can pass values along? Or any other way to do this (field exchange, or what have you)? Ideas are welcomed...

Upvotes: 0

Views: 1456

Answers (2)

Tode
Tode

Reputation: 12060

Technically this is very easy

You define a global variable in your form (or better a Script- Library that you use in the forms Global Options).

Dim uidocOpener as NotesUIDocument

Then in the "Initialize"- Event of the new Form you set that:

Dim ws as New NotesUIWorkspace
Set uidocOpener = ws.CurrentDocument

In that event the new document is not yet open, so CurrentDocument returns the "last" open document (that is your opener).

When saving / closing you then can update fields in the "opener" document as simple as

Call uidocOpener.Document.Replaceitemvalue( "YourItem", Source.Document.Getitemvalue( "YourItem" ) )

But take care: You need to monitor if the opener is still open and make sure somehow, that the user does not edit it while the other window is open, as it does not block the gui as a Dialogbox would.

Upvotes: 1

Duston
Duston

Reputation: 1641

One thing we do (and unfortunately I can't take credit for this, but...) In the "calling form"

Sub Click(Source As Button)
    Dim ws As New notesUiWorkspace
    Dim parent As notesUiDocument
    Dim newui As NotesUIDocument
    Set parent = ws.currentDocument
    Set newui=ws.composeDocument("" , "" , "NewLogEntry")
    Call parent.Close(True)
    Call newui.Refresh
End Sub

This opens the new "dialog" and closes the original form so that the user doesn't get confused.

Then in the "dialog", there's a field called "WorksheetID" (which is the calling form) whose formula is

temp:=@InheritedDocumentUniqueID;
@Text(temp)

Then the "close" or "process" or whatever button has (a) A way to gain access to the original document (with the inherited UNID), and (b) all the information on the "dialog" for to add to that document.

Upvotes: 1

Related Questions