Does your company require that you log everything in Notes? My company does.
I find it tedious to follow up with logging of entries that originate via
Email. Emails that contain design decisions, project approvals, etc. must all
be logged for our customers. I wrote an agent which allows our users to select
one or more documents (related to a specific customer) from their mail file and
convert it into a basic rich text response document (that we call a
miscellaneous activity) to that customer's profile in our customer tracking
database. It supports remote users that are using local database replicas as
well. With a click of a button, important Emails are logged!
It is comprised of two parts: a formula-based agent which may be added to the
mail file actions menu/button bar(s) and a LotusScript agent that is invoked
from the first agent.
The formula-based agent provides a list of available customers (profiles) from
the target database into which the misc document(s) will be stored. Once the
customer is selected, a new document (misc activity) will be created as a
response to that customer's profile for each selected Email.
custList := @DbColumn("": "NoCache"; "852560DE:006C7C79" ;"(CustSort)";1);
@SetEnvironment("Customer"; @Prompt([OKCANCELLIST];"Customer Profiles";"Choose
the customer for which ALL selected memos will be converted to Misc
Activities. Press Cancel if the selected memos are not associated with the
SAME customer profile."; ""; custList));
The LotusScript agent is invoked after the appropriate customer is selected.
The new document identifies the author and recipients of the Email, the
subject, and date. The body of the Email (attachments, doclinks, etc.) is
copied into the body of the new document and the document is saved in the
customer database. If run locally, an alert is displayed to remind the user to
replicate the target database.
Dim s As New NotesSession
Dim curDB As NotesDatabase
Dim db As New NotesDatabase("", "")
Dim view As NotesView
Dim customerProfile As NotesDocument
Dim mailFile As NotesDatabase
Dim memos As NotesDocumentCollection
Dim memo As NotesDocument
Dim miscActivity As NotesDocument
Dim rtitem As NotesRichTextItem
Dim memoBody As Variant ' NotesRichTextItem
Dim docAuthor As NotesName
Dim recipient As NotesName
Dim recipientName As NotesName
Dim companyName As String
Dim n As Integer
Dim count As Integer
Dim server As String
Dim serverName As String
Dim recipientList As String
Dim listLength As Integer
companyName = s.GetEnvironmentString("Customer")
If companyName = "" Then
Messagebox "You must select a customer profile under which to create
the new Misc Activity."
Set curDB = s.CurrentDatabase
server = curDB.Server
If server = "" Then serverName = "Local"
If db.OpenByReplicaID( server, "852560DE006C7C79" ) Then
Set view = db.GetView("(CustSort)")
Set customerProfile = view.GetDocumentByKey( companyName )
If Not customerProfile Is Nothing Then
Set mailFile = s.CurrentDatabase
Set memos = mailFile.UnprocessedDocuments
count = memos.Count
For n = 1 To count
recipientList = ""
Set memo = memos.GetNthDocument( n )
Set miscActivity = New NotesDocument(db)
miscActivity.Form = "Misc"
Set docAuthor = New NotesName(memo.From(0))
miscActivity.DocAuthor = docAuthor.Common
miscActivity.ComposeDate = Format$(memo.Created, "mm-dd-yy")
If memo.PostedDate(0) = "" Then
miscActivity.ActivityDate = Format$(memo.Created,
miscActivity.CompanyName = companyName
Set recipient = New NotesName(memo.SendTo(0))
miscActivity.Subject = "Email to " & recipient.Common & "
RE: " & memo.Subject(0)
Set rtitem = New NotesRichTextItem( miscActivity, "Body" )
Set memoBody = memo.GetFirstItem( "Body" ) '
This was first published in November 2000