Hallo zusammen,
nach langen stöbern habe ich in der Schatzkiste von eknori ein script gefunden, welches mir die geänderten Felder einen Dokumentes ausgibt.
Ich habe das script etwas an meine Wünsche angepasst. Leider gibt es noch ein kleines Problem. Das script gibt nur das erste geänderte Feld wieder.
Ich möchte aber gerne die Wiedergabe alles geänderten Feldwerte. Wo muss ich da ansetzen?
Function DocHasChanged(Source As NotesUIDocument) As Integer
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Set uidoc = workspace.CurrentDocument
Dim doc As NotesDocument
Dim session As New NotesSession
Dim whennow As String
Dim whentoday As String
Dim nam As NotesName
Set doc = source.Document
Set nam = New NotesName(session.UserName)
whenNow = Time()
whentoday = Today()
DocHasChanged = False
'Catch the 'List Item Does Not Exist' Error (In case a new item was added to the document)
On Error 120 Goto newitem
'Don't check new documents
If Not source.IsNewDoc Then
'Step through each item on the document
Forall i In doc.items
nm$ = Ucase(i.name)
If nm$ <> "$REVISIONS" And nm$ <> "$UPDATEDBY" And nm$ <> "SAVEOPTIONS" Then ' Filter out specific fields
vl$ = itemValues(nm$)
If vl$ <> i.Text Then
'We have a change.
DocHasChanged = True
'In this case we want to report the change and stop... you could just as easily replace the two ' lines below with other processing code such as recording the changes to a history field, etc.
'------------------------------------------NEW------------------------------------------
Call uidoc.FieldAppendText("fd_printer_historydate", +whentoday+" at "+whennow+ +Chr(10))
Call uidoc.FieldAppendText("fd_printer_historyfield", nm$ +Chr(10))
Call uidoc.FieldAppendText("fd_printer_historyold", vl$ +Chr(10))
Call uidoc.FieldAppendText("fd_printer_historynew", i.Text +Chr(10))
'Call uidoc.FieldAppendText("fd_printer_historynew", "Field "& nm$ &" was changed on "+whentoday+" at "+whennow+" by "+nam.Abbreviated+" from: "& vl$ &" to: "& i.Text+Chr(10))
'------------------------------------------NEW------------------------------------------
Exit Forall
End If
End If
End Forall
End If
Exit Function
newitem:
' This item is new
vl$ = ""
Resume Next
End Function