I am looking at an agent which runs in my Domino environment which no longer seems to be functioning properly.
The agent runs through a list of documents in a view, and if certain criteria are met, sends an email to any recipients listed in a names field in the currently selected document in the view
This seems to be working fine if the names field only contains one name, but is failing when there are multiple names.
A snippet of code from the original agent is below:
Call SendMsg(MonDoc.Notification_Mon,…
where SendMsg is a sub which creates a notesdocument of form “Memo” and puts the 1st variable passed into the SendTo field before sending. MonDoc is the notes document from the view which has the Notification_Mon names field.
I have tried modifying the agent to iterate through the names field building up a string to pass instead of passing the field reference. This is below:
Recip=“”
RecipField = MonDoc.GetItemValue("Notification_Mon")
Forall n In RecipField
Set Names = New NotesName(n)
If Recip="" Then
Recip= Names.Abbreviated
Else
Recip=Recip & ", " & names.Abbreviated
End If
End Forall
And then calling SendMsg with Recip as the first variable. I have also tried changing the names.X to see if that helped but it did not.
When running this agent from the Actions menu, I get the error that it couldn’t find the name in the domino address book.
As a debug I have had it send the emails directly to me, putting in the Recip value into the body of the email, and it always looks fine to me, sending back somethign like “name/domain, name2/domain”
What am I doing wrong?