This LotusScript code will reside in a button in Lotus Notes users' email. One click will allow them to copy an entire email, including attachments, to a Lotus Notes database. This method is much easier than the alternative of forwarding or copying and pasting email.
The QueryClose code at the end makes the new Lotus Notes document a response of the document selected in the target database. The view, "AdminCustomer UNID," lists all entries in alphabetical order.
Sub Click(Source As Button)
Dim workspace As
New NotesUIWorkspace
Dim picklist As Variant
Dim messagelist As String
Dim originDoc As NotesDocument
Dim custDoc As NotesDocument
Dim resDoc As NotesDocument
Dim resUIDoc As NotesUIDocument
Dim originUIDoc As NotesUIDocument
Set originUIDoc =
workspace.CurrentDocument
Set originDoc = originUIDoc.Document
'First, select the
customer we are going to attach this to
picklist = workspace.PickListStrings
(PICKLIST_CUSTOM,False,"servername",
"database.nsf", "AdminCustomer UNID",
"Database Title", "Please select the customer.", 5 )
Forall plist In picklist
messagelist =
messagelist & plist
End Forall
'Second, we are going to
compose an Email doc
Dim bidDB As
New NotesDatabase("servername","database.nsf")
Set emailDoc = New NotesDocument(bidDb)
emailDoc.Form = "tmpResponse"
emailDoc.Topic = "Email"
emailDoc.Subject = "Incoming -
" & originDoc.Subject(0)
emailDoc.ResDate =
originDoc.PostedDate(0)
emailDoc.ParUNID = messagelist
Dim rtitem As NotesRichTextItem
Set rtitem =
New NotesRichTextItem( emailDoc, "resRich")
Dim success As Variant
success =
originDoc.RenderToRTItem( rtitem )
Set emailUIDoc =
workspace.EditDocument(True, emailDoc)
End Sub
"tmpResponse" is a copy of the form
"Response" in the target database with this:
Sub Queryclose(Source As
Notesuidocument, Continue As Variant)
Set workspace =
New NotesUIWorkspace
Set sess = New NotesSession
Set db = sess.CurrentDatabase
Set uidoc =
workspace.CurrentDocument
Set doc = uidoc.Document
Dim parDoc As Notesdocument
doc.Form = "Response"
Set parDoc = db.
GetDocumentbyUNID(doc.ParUNID(0))
Call doc.MakeResponse(parDoc)
Call doc.Save(True,False)
End Sub
Do you have comments on this tip? Let us know.
This tip was submitted to the SearchDomino.com tip library by member Brian Moore. Please let others know how useful it is via the rating scale below. Do you have a useful Lotus Notes, Domino, Workplace or WebSphere tip or code snippet to share? Submit it to our monthly tip contest and you could win a prize.