I have been asked to keep track of when and who makes changes to attachments.
On my form I have several richtext fields.
I am using @AttachmentNames+ “-” +@Text(@AttachmentModifiedTimes) in a computed field to capture modifications. To keep a record of them I am using http://www-10.lotus.com/ldd/46dom.nsf/c21908baf7e06eb085256a39006eae9f/14e7bb119fbb06b580256ac700359348?OpenDocument
The problem is that @AttachmentModifiedTimes does not update before the code in the Querysave runs.
If I edit an attachment and save it then save the doc once I get no update in the History field. If I save the doc twice the field will update.
Here is what I have tried. I have some uprelated code above this where I Dim and Set docA
Dim comp As String
Dim rtitem1 As NotesRichTextItem
Dim rtitem2 As NotesRichTextItem
Set rtitem1 = docA.GetFirstItem( "SRFDocs" )
Set rtitem2 = docA.GetFirstItem( "InitiateDocs")
rtitem1.Update
rtitem2.Update
comp =docA.ComputeWithForm( False, False )
On Error Goto E
uidoc.Refresh
On Error Goto 0
initial = Source.IsNewDoc
If initial Then m$ = session.CommonUserName & " - " & Cstr(Now()) & " - created document"
Forall F In old
v$ = Source.FieldGetText(Listtag(F))
If Not initial And Not v$ = F Then
If m$ = "" Then
m$ = session.CommonUserName & " - " & Cstr(Now()) & " - modified "
Else
m$ = m$ & ", "
End If
If F = "" Then F = {""}
m$ = m$ & Listtag(F) & " from " & F & " to " & v$
End If
F = v$
End Forall
If initial Then
Source.FieldSetText "History", m$
Elseif Not m$ = "" Then
Source.FieldAppendText "History", Chr$(10) & m$
End If
X: Exit Sub
E: Continue = False
Resume X
End Sub