Hello, I am trying to on a QuerySave event look if a field is set to absent. If so send an email with a doc link otherwise nothing.
Below is my code. However even if the field is set to Absent it skips to the end as if it weren’t true. Any Ideas?
Process = uidoc.FieldGetText("Process")
If Process = “Absent” Then
Dim email As NotesDocument
Dim rti As NotesRichTextItem
Dim nam As NotesName
' create pointer to current document to get field values
Set uidoc = wspace.CurrentDocument
' define TER's owner, approving managers, & status
Employee = uidoc.FieldGetText ("Employee")
' create name object for HR owner (Person)
Set nam = session.CreateName (Employee)
' create common name for TER owner
pers = nam.Common
' get the database
Set db = session.CurrentDatabase
' create a new email document in the database
Set email = New NotesDocument (db)
' create the Subject line of the email
email.Subject = pers + " has a Time & Expense Report for you to review and approve!"
' create the Rich Text item to place in the body of the email
Set rti = New NotesRichTextItem( email, "Body" )
' create the email's body
Call rti.AddNewline (1)
Call rti.AppendText ("Please review " + pers + "'s TER for Weeks " + week + " & " + _
week1 + ".")
Call rti.AddNewline (3)
Call rti.AppendText ("You can open the Time & Expense Report in question by " + _
"clicking on the Document Link below. If the link does not open immediately, " + _
"please try again later ... ")
Call rti.AddNewline (2)
Call rti.AppendText ("Double-click this ==> ")
' create the doc link (doc is the document to link the RTI to & db.Title shows
' the link's database title when you put your mouse over it)
Set doc = uidoc.Document
Call rti.AppendDocLink (doc,db.Title )
' mail the new document
Call email.Send( False, doc.suprvisor)
End If
End Sub