Last Updated Field on a Form

I have 3 forms in a workflow database, each with at least 50 fields on them. I want to create a new field that contains the names of the fields that were changed in the last session by a user. My users are having a difficult time determining what was changed on the form, and this is #1 on their wish list.

I can capture ‘befores’ and ‘afters’ of fields using the entering and exiting events, and was going to just make a script that was called by every field to perform that action. Then it would post the name of the field that was changed into the lastupdated field.

Is there any easier/more efficient way of accomplishing this??

Here is a sample entering event that I was going to put into a script, then I just compare current value in exiting event, this works just fine, but would be difficult to implement on every field:

Sub Entering(Source As Field)

Dim workspace As New NotesUIWorkspace

Dim uidoc As NotesUIDocument

Dim currentValue, thisField, secondaryField As String



thisField = "AHUsage"

secondaryField = "AHClass"



Set uidoc = workspace.CurrentDocument  

currentValue = uidoc.fieldgettext(thisField)

If currentValue <> "" Then

	Call uidoc.FieldSetText("tempValue", currentValue)       

Else

	Call uidoc.FieldClear("tempValue")       

End If

      'Set the tempLocation to the secondary field - done to execute the exiting event in this field if document is saved without moving off of this field.

Call uidoc.FieldSetText("tempLocation",secondaryField)

End Sub

Subject: Last Updated Field on a Form

Here’s something that should work:

  1. In the postopen event, read in all the field values and store them in a List global variable with the field name as the key and the field value as the value.

  2. In the querysave event, go through each field and compare to what is in the list.

Hope this helps

Subject: RE: Last Updated Field on a Form

Thanks for the suggestion. Now I have some work to do!

Subject: Or (if you have multi-value fields or Date/Number fields) you could create a dummy document…

in the postopen event and call doc.CopyAllItems(savdoc), then in the Query Save,changedFields = “”

forall item1 in doc.Items

Set oitem = savdoc.GetFirstItem(item1.Name)

if oitem.Text <> item1.Text then

changedFields = changedFields + item1.Name