The NotesItem class includes a LastModified property. But guess what: while the front end document is open it reports the same date as NotesDocument.LastModified, even if the field hasn't actually been changed. Notes holds the UI document open all the way through to PostSave, so there are no form events where the UI document is empty, which actually makes sense.
The solution is to make Notes think the document isn't open. Enter Delete. I've written about Delete a couple of times before; it removes an object from the Notes cache immediately. Combining this knowledge with some other techniques, we end up with the following
Sub Postsave(Source As Notesuidocument)
'Ignore new documents
If Source.IsNewDoc Then Exit Sub
Dim db As NotesDatabase
Dim session As New NotesSession
Dim doc As NotesDocument
Dim maildoc As NotesDocument
Dim tmpID As String
Set db = session.CurrentDatabase
tmpID = source.document.UniversalID
'Force the front end document to close
'Delete it from the cache
'Reopen the backend document
Set doc = db.GetDocumentByUNID(tmpID)
' Checks for field(s) that have been modified and sends a notification.
Forall item In doc.Items
If (item.LastModified >= doc.LastModified) Then
Set maildoc = New NotesDocument( db )
maildoc.Form = "Memo"
' Person to be notified.
maildoc.SendTo = "<name>"
maildoc.Subject = "<subject>"
Set rtitem = New NotesRichTextItem( maildoc, "Body" )
Call rtitem.AppendText( "The iteration for """ + doc.Title(0) + """ was changed by " + session.UserName + "." )
Call rtitem.AddNewLine( 2 )
Call rtitem.AppendText( "Link to Document -> " )
Call rtitem.AppendDocLink( doc, db.Title )
Call maildoc.Send( False )
provided by Julian Robichaux at nsftools.com.