Manage Learn to apply best practices and optimize your operations.

Send Email/Doclink To User(S) If A New Document Is Added To A Db

I have a workflow database that I want to send out
and email when a new MER document is added to our MER database. Place this code
in the QuerySave Event.
QuerySave Event:

Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim newdoc As NotesDocument
Dim rtitem As NotesRichTextItem

Set db = session.CurrentDatabase
Set doc = source.Document

If Source.IsNewDoc = True Then
Set newdoc = New NotesDocument(db)
Set rtitem = New NotesRichTextItem_
(newdoc, "Body")

Call rtitem.AppendText("A new MER request has
been added to the MER database. Double click
on the link below to view the request:")

Call rtitem.AddNewLine(1)
Call rtitem.AddNewLine(1)
Call rtitem.AppendDocLink (doc, doc.Subject(0))
newdoc.Subject = "New MER: " + doc.Subject(0)
newdoc.SendTo = doc.RouteList
Call newdoc.Send (False)
Else
If doc.Status(0) <> "In Review" And doc.Status_
(0) <> StatusValue Then
Set newdoc = New NotesDocument(db)
Set rtitem = New NotesRichTextItem_
(newdoc, "Body")
Call rtitem.AppendText("The status-irr of a
form in the MER database has been changed.
Double click on the link below to verify
the change:")
Call rtitem.AddNewLine(1)
Call rtitem.AddNewLine(1)
Call rtitem.AppendDocLink (doc, doc.Subject_
(0))
newdoc.Subject = "MER Status-IRR Change: " +_
doc.Subject(0)
newdoc.SendTo = doc.SRouteList
Call newdoc.Send (False)
Call Source.FieldSetText("Status", "In_
Review")
End If
End If

Dig Deeper on Lotus Notes Domino Administration Tools

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close