Hallo, ich bastle immer noch an einer Dialogbox, mit deren Hilfe User einen Dokumentlink direkt aus einer Liste von Dokumenten erzeugen können.
Jetzt habe ich ein Skript bei eknori.de in der Schatzkiste gefunden, das hakelt aber irgendwo..
Und zwar bekomme ich im Kombi-Feld "Pick" keine Werte angezeigt; das Feld "List" zeigt aber Werte an. "Pick" will also nicht übernehmen.
Und beim speichern bekomme ich die Fehlermeldung "object variable not set"..
Hat jemand einen Tipp?
felix
hier das skript:
The set up:
You will need a dialog box form for displaying the drop down list in LotusScript since LotusScript does not provide a drop down list control.
Create the form, I will call it (dlgDocPick). On the form create a multi-valued text box named List with the following Default value:
list := @DbColumn( "" : "NoCache" ; "" ; "Projects" ; 1 );
Where Projects represents a sorted view of all Project document titles.
This field will contain the actual values displayed in our drop down list. Also create a layout region with a combo box named
Pick on the dialog form. For the Default value of the combo box use ?List?, the multi-valued text list we created outside the layout region.
On the Issue form create an Action button called Reassign Project.
Set the button properties to Hide when the document is in edit mode since we do not need to ?edit?
the document to reassign the Doclink via LotusScript. Likewise, preventing the use of this function from a document in edit mode prevents the confusing ?Save?
messages Notes will generate from the backend script. This button will contain the script for presenting the new Project documents list dialog box and
assigning the newly selected document Doclink to the current document.
The form also contains a RTF named Link which will hold the DocLink. The LotusScript for the Action button appears below.
Sub Click(Source As Button)
Dim session As New notessession
Dim db As NotesDatabase
Set db = session.CurrentDatabase
' We need to have a workspace in order to present
' the drop-down list via the dialog form
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Set uidoc = ws.CurrentDocument 'get the frontend doc
Dim backendDoc As NotesDocument
Set backendDoc = uidoc.Document 'get the backend doc
' the doclink field on our current document
Dim rtDocLink As NotesRichTextItem
' this doc will be our dialog box. Note that it is
' only used for display. It does not gets saved.
Dim docPick As New NotesDocument( db )
' Present the dialog box and continue with the Doclink
' update if the user selects a value from the list.
If ws.dialogbox( "(dlgDocPick)", True, True, False, False, False, False, "Bitte Dokument auswählent", docPick ) Then
'Msgbox docPick.Pick(0) 'DEBUG: verify we have the right value
' Fetch this Project and replace it in the
' doc link on this form
Dim newProjectDoc As NotesDocument
Dim view As NotesView
Set view = db.GetView( "(Default View)" )
Set newProjectDoc = view.GetDocumentByKey( docPick.Pick(0), True )
' Remove the old link
backendDoc.RemoveItem( "Link" )
' Put in the new link
backendDoc.CreateRichTextItem( "Link" )
Set rtDocLink = backendDoc.GetFirstItem( "Link" )
Call rtDocLink.AppendDocLink( newProjectDoc, "DocLink" )
Call backendDoc.Save( True, False )
' Close the UIdoc so the user can reopen it to see
' the new link. This is LotusScript limitation!
uidoc.Close
End If
End Sub