Hi,
gewöhnlich erwartet Notes, dass für Antwort-Dokumente eine eigene Maske verwendet wird. Dort setzt man unter Type "Response" oder "Response 2 Response".
Ich habe aber hier das Ziel, für Haupt- und Antwortdokumente nur 1 Maske zu verwenden.
Nun kann man ja über die MakeResponse Methode der NotesDocument-Klasse ein Dokument zum Response-Dokument machen. Klappt auch wunderbar. Erstellt man allerdings ein neues NotesDocument, setzt das "Du bist eine Response"-Flag und holt sich ohne zu Speichern das Dokument dann ins Frontend, so wird daraus keine Response. Man muss wohl das Backend-Doc zuerst speichern ???
Sub Click(Source As Button)
'Constants for this procedure
Const FORMNAME_RESPONSE$ = "frmTest"
Const ERR_NODOCSEL_TITLE$ = "Error: No document selected"
Const ERR_NODOCSEL_MSG$ = "You need to select a document to create a response document of it."
On Error Goto ErrorHandler 'Of course we trap errors
'The dim section
Dim uiws As New NotesUIWorkspace
Dim uidocNew As NotesUIDocument
Dim session As New NotesSession
Dim db As NotesDatabase
Dim docSel As NotesDocument
Dim docNew As NotesDocument
'We need the current database
Set db = session.CurrentDatabase
'Get current document as NotesDocument object
If Not uiws.CurrentDocument Is Nothing Then
Set docSel = uiws.CurrentDocument.Document 'Document opened in form
Elseif Not session.DocumentContext Is Nothing Then
Set docSel = session.DocumentContext 'Document selected in view
End If
If docSel Is Nothing Then 'User did not select a document
Msgbox ERR_NODOCSEL_MSG, 48, ERR_NODOCSEL_TITLE
Goto GoOut
End If
'Create new backend response document
Set docNew = db.CreateDocument
Call docNew.ReplaceItemValue("Form", FORMNAME_RESPONSE)
Call docNew.MakeResponse(docSel)
Call docNew.Save(True, False) 'XXXXXXXXXX Das hier wollen wir eigentlich nicht ! XXXXXXXXXXX
'Finally, open new document in the frontend
Call uiws.EditDocument(True, docNew)
GoOut:
Exit Sub
ErrorHandler:
ErrorMsg
Resume GoOut
End Sub
Problem hier: Ich will das neue Dokument *nicht* speichern. Ohne zu speichern wird aber kein Response-Document daraus :(
Hab ich da vielleicht was übersehen? Oder ist auch aus anderen Gründen davon abzuraten, eine Maske sowohl für Main- und Response-Dokumente zu verwenden. IBM macht das ja wohl auch nicht, wenn man sich die Templates ansieht.
Ich möchte das eigentlich vermeiden und lieber mit Hide/When arbeiten, um redundante Masken zu vermeiden.
Matthias