Newsletter summary problem

I need to create a newsletter summary & have it run on a schedule. I have created a view that contains the documents (if any for that week) that should be listed on the summary. It works great when I run it manually, because I can select my target as all documents in the view. However, when I schedule it, the only options are all docs or all new/modified docs. When I do this, it still pulls the info on the correct ones, but I also “This document was not found in the view specified by the agent” over and over for each document in the db that was not in the view.

I know there has to be a way around this, but I cannot figure out what I need to do. I am not very good at LotusScript, and I have tried playing with the following. However, I am still not getting what I need.

Basically, what I need is an email with a listing containing information from 4-5 fields on documents that have been declined in the past 7 days. I have a declined field on my form that is a date field.

Here is one of my attempts at writing the script, but I am still not getting what I want.

Dim session As New NotesSession

Dim db As NotesDatabase

Dim collection As NotesDocumentCollection

Dim newsletter As NotesNewsletter

Dim doc As NotesDocument

Set db = session.CurrentDatabase

Set mailDb = New NotesDatabase ("","")

Call mailDb.openmail

Set collection = db.UnprocessedDocuments

Set newsletter = New NotesNewsletter( collection )

If ( collection.Count > 0 ) Then

	Set doc = newsletter.FormatMsgWithDoclinks( db )

	doc.Form = "Memo"

	doc.Subject = "Declined Claims for the week"

	Call doc.Send( False, "Alison Wills" )

End If

Any help would be greatly appreciated.

Subject: Change it like this…

Dim session As New NotesSession	Dim db As NotesDatabase

Dim v As NotesView

Dim collection As NotesDocumentCollection

Dim newsletter As NotesNewsletter

Dim doc As NotesDocument

Set db = session.CurrentDatabase

Dim v = db.GetView("Yours")

Set mailDb = New NotesDatabase ("","")

Call mailDb.openmail

Set collection = v.GetAllDocumentsByKey("", False) 'This should return all documents in view

Subject: Thanks! That worked

The only other thing I had to do was to add a column in my view for the key, because when I used the “”, it did not find anything in the view.

Now onto the next challenge…getting it to send info from my documents with the doclinks like the newsletter summary does.

Thank you so much for your help!