Notification sub function

Use this sub function to create and send emails based off the current uidocument. It automatically references the source database server and path.

Sub SendAssignedToNotification(uidoc As NotesUIDocument)
	Dim session As New NotesSession
	Dim db As NotesDatabase
	Dim docMail As NotesDocument
	Dim rtBody As NotesRichTextItem
	Dim nameServer As NotesName
	Set db = session.CurrentDatabase
	Set docMail = db.CreateDocument
	docMail.Form = "Memo"
	docMail.SendTo = uidoc.FieldGetText("AssignedTo")
	docMail.Subject = "A Support Ticket has been assigned to you (Ticket#: " & uidoc.FieldGetText("TicketNumber") & ")"
	Set rtBody = New NotesRichTextItem(docMail, "Body")
	Call rtBody.AppendText("A Support Ticket has been assigned to you in the " & db.Title & " database.")
	Call rtBody.AddNewline(2)
	Call rtBody.AppendText("Subject:  " & uidoc.FieldGetText("Subject"))
	Call rtBody.AddNewline(2)
	Call rtBody.AppendText("Click on this link to view/update the ticket --->")
	Call rtBody.AppendDoclink(uidoc.Document, db.Title)
	Call rtBody.AddNewline(2)
	Call rtBody.AppendText("OR, if you cannot access the database via the doclink, you can try to open it directly by following these steps:")
	Call rtBody.AddNewline(2)
	Call rtBody.AppendText("1. Click on File - Database - Open on the menu. This will bring up the Open Database dialog box.")
	Call rtBody.AddNewline(1)
	Set nameServer = New NotesName(db.Server)
	Call rtBody.AppendText("2. In the box for Server, select or type in " & nameServer.Abbreviated & ".")
	Call rtBody.AddNewline(1)
	Call rtBody.AppendText("3. In the box labeled Filename, type in the following filepath: " & db.Filepath)
	Call rtBody.AddNewline(1)
	Call rtBody.AppendText("4. Click the Open button.")
	Call rtBody.AddNewline(2)
	Call rtBody.AppendText("These steps should result in immediately opening the database and adding it to your Notes workspace. In the future, if the doclinks still do not work properly, you can enter the database directly by double-clicking on the icon that has been added to your Notes workspace.")
	Call docMail.Send(False)
End Sub

Posted by fbrefere001 on Tuesday March 12, 2002