|
|
Put this script in the QueryClose event of the document. It will append the RTF field named Details to an RTF field named Details_History:
FIELD Details: Rich Text, Editable Hide when previewed for reading, opened for reading, printed
FIELD Details_History: Rich Text, Computed never hide
Sub Queryclose(Source As Notesuidocument, Continue As Variant) On Error Goto Oops
Dim session As New NotesSession
Dim doc As NotesDocument
Set doc = session.CurrentDatabase.GetDocumentByUNID(Source.Document.UniversalID)
Dim vDetails As Variant
Set vDetails = doc.GetFirstItem("Details")
Dim vHistory As Variant
Set vHistory = doc.GetFirstItem("Details_History")
If (vDetails.Type = RICHTEXT And vHistory.Type = RICHTEXT) Then
Call vHistory.AppendText(Format$(Now, "mm/dd/yy hh:nn AM/PM") & " by " & session.CommonUserName & ": ")
Call vHistory.AppendRTItem(vDetails)
Call vHistory.AddNewLine(2)
Call vDetails.Remove
Call doc.Save(True, False)
End If
TheEnd: Continue = True Exit Sub
Oops: Resume TheEnd End Sub