I have the need to copy a document in a db to a new task in the users own maildb and have below script for it.The script creates a task in the maildb, but copies the whole content rather then filling the fields of the task form with the data in the form to be copied. Please, what am i doing wrong?
Sub Click(Source As Button)
Dim session As New NotesSession
Dim db As NotesDatabase
Dim mailDb As NotesDatabase
Dim collection As NotesDocumentCollection
Dim newsletter As NotesNewsletter
Dim doc As NotesDocument
Set db = session.CurrentDatabase
Set mailDb = New NotesDatabase( "", "" )
Call mailDb.OpenMail
Set collection = db.UnprocessedDocuments
Set newsletter = New NotesNewsletter( collection )
If ( collection.Count > 5 ) Then
Messagebox( "Please select five documents or fewer" )
Else
For j = 1 To collection.Count
Set doc = newsletter.FormatDocument( mailDb, j )
Call doc.ReplaceItemValue _
("Form", "Task")
Call doc.Save( True, True )
Next
End If
End Sub