By Johannes Madsen
For several years, I have been using an agent in TeamCase, a CRM (Customer Relationship Management) system, that when executed would create a new Notes email, using the email addresses specified in the selected contact documents. The agent was executed using view and document action buttons, being most useful in a view where users are able to select the contacts they want to email. But the agent was also available when a specific contact document was open, enabling the user to compose an email to the contact easily.
As far as I remember, the agent was written in Lotus Script, and was originally inspired by a similar agent in version 4.x of the Personal Name & Address Book.
The old method
Here's how the agent worked. First, a collection of the selected contact documents was retrieved, and then a string array with length equal to the number of documents was created. Next, for each contact, the email address was stored in the corresponding array element.
The Notes mail database was then opened and a document was created. The string array was moved to the SendTo field and the Form field was set. Finally, the new document was handed over to the user using NotesUIWorkspace.EditDocument
The agent consisted of more than 50 lines of code, and I must admit, this seemed to be a lot for this simple task. But once it had been coded and seemed to work, I didn't pay much attention to it. After all, I had only done the same as Lotus, so I assumed this was the best way to do it. However, there was one situation the agent couldn't handle.
The contact document contained a field for the contact's private email address, but the system didn't offer a button to easily compose an email using that email address, because the agent was coded to use the office email address. For some reason, only web agents can have parameters, so most of the code would have to be repeated, or moved into a shared script library, to support a secondary field.
A simpler way to create a Notes email
I recently received a new requirement. A company who used Outlook for emailing, wanted to purchase just the shared contacts database, and they wanted to be able to create Outlook emails to selected contacts, similar to the way Notes emails could be created.
At first I thought that this would make my agent even more complex. It would have to find out if Notes or Outlook mail was being used, and it would have to include some COM programming in order to make Outlook create the email and insert the receiving addresses into it.