The user ticks multiple people on a checkbox field. They then click on a notify button which sends an email to all the selected users with a document link.
Subject: Sending email to multiple selected people
Here’s some sample code. I’m assuming the field name is called ‘People’.
Sub Initialize
Dim Session As New NotesSession
Dim ws As New NotesUIWorkspace
Dim CurrDb As NotesDatabase
Dim uidoc As NotesUIDocument
Dim Doc As NotesDocument
Dim SelectedPeople As NotesItem
Dim MailDoc As NotesDocument
Dim BodyItem As NotesRichTextItem
Set CurrDb = Session.CurrentDatabase
Set uidoc = ws.CurrentDocument
Set Doc = uidoc.Document
Set SelectedPeople = Doc.GetFirstItem("People")
Forall Selected_Person In SelectedPeople.Values
If Trim(Selected_Person) <> "" Then
Set MailDoc = New NotesDocument(CurrDb)
MailDoc.SendTo = Selected_Person
MailDoc.Subject = "This is a test message"
Set BodyItem = New NotesRichTextItem(MailDoc, "Body")
Call BodyItem.AppendText("This is a test message")
Call BodyItem.AddNewLine(2)
Call BodyItem.AppendText("Regards,")
Call BodyItem.AddNewLine(2)
Call BodyItem.AppendText(Session.CommonUserName)
Call MailDoc.Send(False)
End If
End Forall
Your script would send the email repeatedly. It would be better to set the .SendTo of the mail document to the array of People, send it once, and be done with it after one send.