I’ve always kept track of who “last” modified the document by combining two fields: “Name” containing a formula “(@Name([CN];@UserName)” with a field “Date” and a formula of “@Text(@Modified)”. Obviously that displays the last person that modified the document and the time/date. I need to show “everyone” who modified the form in a list like something below:
Updated By:
Jeremy Deal at 1:04pm on 5/6/2005
Joe Smith at 11:05am on 5/5/2005
Jane Doe at 12:30pm on 3/1/2005
Is this possible to do? What about in a form?
Subject: Thanks both of you! I only have a minor issue now.
I am currently trying out Gregs suggestion and it works great on the first save. But when editing the document and saving it a second time I get the following error on the “EhRev” field:
“ERROR: Incorrect data type for operator or @Function: Text expected”
I have the corresponding formula set to each field that Greg suggested from his first post. Shown below are the three fields I have and what their properties are:
EhEditor - Field type is Authors, Computed, allow multiple values.
EhDate - Field type is Date/Time, Computed, allow multiple values.
EhRev - Field type is Text, Computed, allow multiple values.
Any suggestions on why I am getting the error upon the second save?
Subject: RE: Thanks both of you! I only have a minor issue now.
I have EhRev set up as a number field. Sorry I didn’t follow back up on this sooner.
Subject: RE: Thanks both of you! I only have a minor issue now.
Thanks Greg, that fixed it.
Subject: How do I properly show an “updated by” list?
I usually do this as part of a workflow script like this:
Sub AddToAuditHistory( message As String, CurrDoc As NotesDocument, strFieldName As String)
Dim session As New NotesSession
Dim n As Integer
Dim anyElem As Integer
Dim vHistory As Variant
Dim strHistoryField As String
Dim outList() As String
Dim abbrevname$
anyElem=False
abbrevname=session.CreateName(session.Username).Abbreviated
vHistory=currdoc.GetItemValue(strFieldName)
n=0
Forall Elem In vHistory
anyElem=True
n=n+1
End Forall
If Not anyElem Then
outlist(0)= Format(Now,"mm/dd/yyyy hh:nn:ss
AM/PM") + " - " + message + " by " +
abbrevname
Else
Redim outlist(n)
outlist(0)= Format(Now,"mm/dd/yyyy hh:nn:ss
AM/PM") + " - " + message + " by " +
abbrevname
n=1
Forall Elem In vHistory
outlist(n) = Elem
n=n+1
End Forall
End If
Call CurrDoc.ReplaceItemValue(strFieldname,
outList)
End Sub
This approach allows me to have custom messages as to what exactly has been done (which you really should do to have a solid audit trail) and is called from a script library in the query save event.
Subject: How do I properly show an “updated by” list?
Here is what we use, we have an eheditor and ehdate fields that have these formulas. They give the last 5 updates, you can increase this to your needs. Of course also set the field to allow multiple values. We also have a verson field too, so you can see that there were more history at a point (if it is past version 5,1 drops off):
@If(@IsDocBeingSaved; @If(EhEditor = “”; @V3UserName; @V3UserName : @If(@Elements(EhEditor) > 4; @Subset(EhEditor; 4); EhEditor)); @IsNewDoc; “”; EhEditor)
@If(@IsDocBeingSaved; @If(EhDate = “”; @Now; @Now : @If(@Elements(EhDate) > 4; @Subset(EhDate; 4); EhDate)); @IsNewDoc; “”; EhDate)
@If(@IsDocBeingSaved; @If(EhRev = “”; 0; (@Subset(EhRev; 1) + 1) : @If(@Elements(EhRev) > 4; @Subset(EhRev; 4); EhRev)); @IsNewDoc; “”; EhRev)
Subject: RE: How do I properly show an “updated by” list?
Thank you both of you. Im trying the formula Greg uses and it works great when saving the first time. However when editing the document and saving the second time (and every time after) I get the following error in the EhRev field:
“ERROR: Incorrect data type for operator or@Function: Text expected”
Here is how I have my feilds set up with correcsponding code that Greg reccomended.
EhEditor (Field type is Author and allow multiple values)
EhDate (Field type is Date/Time and allow multiple values)
EhRev (Field type is Text and allow multiple values)
Any suggestions why I get the error?