I have a approval button in a view and I have no problem using backend methods to set the status to approved. The issue I have is appending a history message to the existing message. I want to be able to get the old history value, write a transaction, and place it at the end of the old history value and I’m not sure how to do that:
Here is my code thus far:
Dim session As New NotesSession
Dim db As NotesDatabase
Dim collection As NotesDocumentCollection
Dim doc As NotesDocument
Set db = session.CurrentDatabase
Set collection = db.UnprocessedDocuments
Set doc = collection.GetFirstDocument()
count = 0
While Not(doc Is Nothing)
Set item = doc.GetFirstItem( "Approver" )
Set status = doc.GetFirstItem( "Status" )
Set nam = session.CreateName( _
session.UserName)
If item.Contains( nam.common) And status.contains("Pending Approval") Then
doc.Status = "Approved"
Call doc.Save( False, True )
count = count +1
doc.ApprovedBy = nam.common
doc.approvalDete = Today
'Dim oldhistory As String
'oldhistory =doc.fieldgettext("History")
'Dim newhistory As String
'newhistory = oldhistory + ";" + nam.common + " has approved the time sheet on "
'Call doc.fieldsettext("History", newHistory + Today)
End If
Set doc = collection.GetNextDocument(doc)
Wend
Msgbox(count) + " timesheets approved."
Dim ws As New NotesUiWorkspace
Call ws.ViewRefresh