Track Document History

Hi:

I intend to create a history at the bottom of a document to keep track on who has changed a document, with User Name, Date & Time only.

I read those questions posted with developement and was being advise to refer to the NotesTracker.nsf. I tried - it’s too complicated as it comes with versioning…revision.

I need something simple - everytime a user change the document, regardless with any field change, his / her name together with date and time will be added onto the bottom of the document.

Many thanks in advace for your reply.

p/s: formula / lotusscript is ok. best if can track and display from web access or at least notes client.

Subject: Track Document History

Hi,

Here is a simple solution I use for displaying document history.

The computed text fields to your form. E1 , A1, D1

Make them multi-value fields and make the “display seperate values with” option set to newline. Make all three fields have a formula of themselves. So E1 field value is E1, A1 is A1 and D1 is D1.

With these fields create a table that looks like this

Revision: Editor: Edit Date:

Then add the following code to the QuerySave Event of the form.

Sub Querysave(Source As Notesuidocument, Continue As Variant)

Dim Doc As NotesDocument

Dim Sess As New NotesSession

Dim E1 As NotesItem

Dim A1 As NotesItem

Dim D1 As NotesItem

Dim TimeNow As New NotesDateTime("")

Dim TempArray() As String



Set Doc = Source.Document

Call TimeNow.SetNow()



If Doc.E1(0) = "" Then

	Doc.E1 = "1"

	Doc.A1 = Sess.CommonUserName

	Doc.D1 = TimeNow.DateOnly + " " + TimeNow.TimeOnly

Else	

	

	Set E1 = Doc.GetFirstItem("E1")

	Set A1 = Doc.GetFirstItem("A1")

	Set D1 = Doc.GetFirstItem("D1")

	

	Redim TempArray(Ubound(E1.Values) + 1)

	TempArray(0) = Cstr(Ubound(E1.Values) + 2)

	i = 1

	Forall vals In E1.Values

		TempArray(i) = Cstr(vals)

		i = i + 1

	End Forall

	

	E1.values = TempArray

	

	TempArray(0) = Sess.CommonUserName

	i = 1

	Forall vals In A1.Values

		TempArray(i) = Cstr(vals)

		i = i + 1

	End Forall

	

	A1.values = TempArray

	

	TempArray(0) = TimeNow.DateOnly + " " + TimeNow.TimeOnly

	i = 1

	Forall vals In D1.Values

		TempArray(i) = Cstr(vals)

		i = i + 1

	End Forall

	

	D1.values = TempArray

	

End If

End Sub

Subject: RE: Track Document History

Bravo Simon Hendry…You are brilliant.

Your answer is perfectly right.

Tx for answering me promptly and direct to what I’m looking for. Many many thanks.

:))

Subject: RE: Track Document History

Hello Simon,

I have no idea about writing commands in lotus script so I just copied the command in your response and it is working well. I have a “Status” field in my document and I would want to track the change in status of the document every time I save it. I tried adding the field S1 for status but only the latest status is reflected in the document history.

3 2017/09/29 10:00 AM Iris P. Pending for Transmittal

2 2017/09/28 4:05 PM Iris P.

1 2017/09/28 4:00 PM Iris P.

I want my document history to be like this. I hope you can help me. :cry:

3 2017/09/29 10:00 AM Iris P. Pending for Transmittal

2 2017/09/28 4:05 PM Iris P. On-going

1 2017/09/28 4:00 PM Iris P. Pending for logging

Thank you.