Recieve daily email conflict reports
Use this script in a scheduled agent that runs every night. It will send you an email conflict report for each database with conflicts containing links to all the conflicts. Modify the script and add the databases you want a report for and who should recieve the reports
Sub Initialize
On Error GoTo e
Dim session As New NotesSession, db As NotesDatabase
Dim xdb As NotesDatabase,maildoc As NotesDocument, rt As NotesRichTextItem
Dim searchstring As String, dc As NotesDocumentCollection, tot As Long
Dim server As String, subj As String
Set db = session.currentdatabase
server = "domino1"
Dim dbs( 0 To 3 ) As String
dbs( 0 ) = "names.nsf"
dbs( 1 ) = "crm.nsf"
dbs( 2 ) = "invoice.nsf"
dbs( 3 ) = "intranet.nsf"
Set maildoc = db.Createdocument()
maildoc.Form = "Memo"
Set rt = maildoc.createrichtextitem("Body")
Call rt.Appendtext("Click here to open conflict database -> ")
Call rt.Appenddoclink(db,"Conflict db")
Call rt.Addnewline(2)
Dim recepients( 0 To 1 ) As String
recepients( 0 ) = "john.doe@acme.com"
recepients( 1 ) = "foo@acme.com"
ForAll sdb In dbs
Set xdb= session.GetDatabase(server,sdb)
Dim i As Integer, d As NotesDocument
searchString = "@IsAvailable($Conflict)"
Set dc = xdb.Search(searchstring,Nothing, 0)
tot = tot + dc.count
If subj = "" Then
subj = subj + xdb.Title + " (" + CStr(dc.Count) + ")"
Else
subj = subj + " / " + xdb.Title + " (" + CStr(dc.Count) + ")"
End If
Call rt.Addnewline(2)
Call rt.Appendtext(xdb.Title + " (" + CStr(dc.Count) + ")")
Call rt.Addnewline(2)
For i = 1 To dc.count
Set d = dc.getNthDocument(i)
Call rt.Appenddoclink(d,"Link")
Call rt.Appendtext(" - " + d.Form(0) + " - Last modified by: " + Implode(Evaluate(|@Name([CN];@Subset($UpdatedBy;-1))|,d)) + " at " + CStr(d.Lastmodified))
Call rt.Addnewline(1)
Next
End ForAll
maildoc.Subject = "Conflict Report - Total: " + CStr(tot) + " - " + subj
Call maildoc.Send(False,recepients)
Exit Sub
e:
Print Error,Erl
End Sub
Relevanta Poster på Notessidan: