Agent to Email Field Names and Values

Author: Tripp W Black

Created: 03/02/2002 at 08:01 PM

 

Category:
Notes Developer Tips
Agents, Fields

Sub Initialize
Dim s As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim values As Variant
Set doc = s.DocumentContext
Set db = s.CurrentDatabase

Dim mailDoc As NotesDocument
Set mailDoc = db.CreateDocument
Dim rtItem As NotesRichTextItem
Set rtitem = New NotesRichTextItem ( mailDoc, "Body" )
Forall i In doc.Items
Call rtItem.AppendText ( "Field: " & i.Name)
Call rtItem.AddNewLine (1)
values = doc.GetItemValue( i.Name )
Forall v In values
Call rtItem.AppendText(v)
Call rtItem.AddNewLine(1)
End Forall
Call rtitem.AddNewLine (1 )
End Forall

' mail the results
mailDoc.Form = "Memo"
mailDoc.Subject = "Fields and current values for form " & doc.Form(0) & ". Document is : " & doc.Title(0)
mailDoc.SendTo = "Tripp Black"
mailDoc.ReplyTo = "- Do not reply. System agent -"
mailDoc.From = "- Do not reply. System agent -"
mailDoc.Principal = "Tripp Black"
mailDoc.SaveMessageOnSend = False
Call mailDoc.Send( False, mailDoc.SendTo)
End Sub


previous page