Hi there,
I m having one categorized view, which contains set of data.
now the thing is i would like to mail this view in table format to some specified persons (hardcoded), using schduled agent in Lotus Script,
hurdles comes that the given code sends the mail money times. so i want mail to be sent only once.
Please help me in given code where i can modify the code.
???Code goes here???
Sub Initialize
On Error Goto errorhandler
Dim session As New notessession
Dim dbCurrent As NotesDatabase
Dim searchString As String
Dim RTitem As NotesRichTextItem
Dim NDT1 As NotesDateTime
Dim NDT2 As NotesDateTime
Dim vwTarget24 As notesview
Dim docvwTarget24 As NotesDocument
Dim counter As Integer
Dim entryDoc As NotesDocument
Dim entryctr As Integer
Dim entryB As NotesViewEntry
Dim docMail As NotesDocument
Dim nav As NotesViewNavigator
Dim entry As NotesViewEntry
Set dbCurrent = session.CurrentDatabase
Set vwTarget24 = dbCurrent.GetView("vwBYLast24Hrs")
Set nav = vwTarget24.CreateViewNav
Set entry = nav.GetFirst
If vwTarget24 Is Nothing Then
Msgbox " the view " & vwTarget24 .Name & " doesnt contain any document, Please contact administrator"
Exit Sub
End If
If Not entry Is Nothing Then
sblCount=entry.SiblingCount
For b = 1 To sblCount
Set docMail = dbcurrent.CreateDocument
Set rtitem = New NotesRichTextItem( docMail, "Body" )
docMail.Form = "Memo"
docMail.subject = "Sev-1 alert Last 24 Hrs"
Call rtitem.AppendTable(1,4)
Dim rtnav As NotesRichTextNavigator
Set rtnav = rtitem.CreateNavigator
Call rtnav.FindFirstElement(RTELEM_TYPE_TABLECELL)
Call rtitem.BeginInsert(rtnav)
Call rtitem.AppendText("Account Name")
Call rtitem.EndInsert
Call rtnav.FindNextElement(RTELEM_TYPE_TABLECELL)
Call rtitem.BeginInsert(rtnav)
Call rtitem.AppendText("User" )
Call rtitem.EndInsert
Call rtnav.FindNextElement(RTELEM_TYPE_TABLECELL)
Call rtitem.BeginInsert(rtnav)
Call rtitem.AppendText("Service Line" )
Call rtitem.EndInsert
Call rtnav.FindNextElement(RTELEM_TYPE_TABLECELL)
Call rtitem.BeginInsert(rtnav)
Call rtitem.AppendText("GDC")
Call rtitem.EndInsert
Dim rtt As NotesRichTextTable
Set rtt = rtnav.GetFirstElement(RTELEM_TYPE_TABLE)
CL=5
entryctr = entry.ChildCount
If entryctr > 0 Then
Set entryB=nav.GetNext(entry)
Call rtt.AddRow(entryctr)
Call rtnav.FindNthElement(7,CL)
For a = 1 To entryctr
Set entryDoc=entryB.Document
If Not entryDoc Is Nothing Then
Call rtitem.BeginInsert(rtnav)
Dim AccountName As Variant
AccountName=empty
AccountName=entryDoc.GetItemValue("xyz")
Call rtitem.AppendText(AccountName(0))
Call rtitem.EndInsert
CL=CL+1
Call rtnav.FindNthElement(7,CL)
Call rtitem.BeginInsert(rtnav)
Dim GDC As Variant
GDC=empty
GDC=entryDoc.GetItemValue("submittedby")
Call rtitem.AppendText(GDC(0))
Call rtitem.EndInsert
CL=CL+1
Call rtnav.FindNthElement(7,CL)
Call rtitem.BeginInsert(rtnav)
Dim ticketNo As Variant
ticketNo=empty
ticketNo=entryDoc.GetItemValue("rwse")
Call rtitem.AppendText(Cstr(ticketNo(0)))
Call rtitem.EndInsert
CL=CL+1
Call rtnav.FindNthElement(7,CL)
Call rtitem.BeginInsert(rtnav)
Dim createdON As Variant
createdON=entryDoc.GetItemValue("rpzc")
Call rtitem.AppendText(Cstr(createdON(0)))
Call rtitem.EndInsert
CL=CL+1
Call rtnav.FindNthElement(7,CL)
End If
Set entryB=nav.GetNextSibling(entryB)
Next
End If
Set entry = nav.GetNextCategory(entry)
Next
End If
docMail.SendTo="XYZ person"
Call docMail.Send( False )
Exit Sub
errorhandler:
Print "Error " & Error & " has occurred on line number " &Cstr(Erl)
Exit Sub
End Sub
----------Code ends here-------------------------------------------
thanks
dev