Link to home
Create AccountLog in
Avatar of kali958
kali958Flag for United States of America

asked on

Run schedule agent on specific view

I need to have a agent run on documents in a view at night to update them and send an email to Supervisors.

I currently have written this:

Sub Initialize
      
      Dim s As New NotesSession
      Dim db As NotesDatabase
      Dim view As NotesView
      Dim doc As NotesDocument
      Dim agent As NotesAgent
      
      Set db = s.CurrentDatabase
      Set view = db.GetView( "lkupPendingRequests")
      Set agent = db.GetAgent("Supervisor")
End Sub

I feel that I am missing something to actually kick off the agent. When I run the agent Supervisor manually it works but when run it scheduled, it will not run. Any ideas?
Avatar of SysExpert
SysExpert
Flag of Israel image

You need to execute the agent as scheduled, , and have it get the documents/ view. Why do you need two separate processes ?


I hope this helps !
ASKER CERTIFIED SOLUTION
Avatar of olaraak
olaraak
Flag of Estonia image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Oh, and if your view- processing code is in agent Supervisor, then there is no need to get the view or document before starting mentioned agent.

Or did I misunderstood something?
Avatar of kali958

ASKER

I do not want to run the agent on all the documents in the database.

I have a selection on the view that if the ContactName != Supervisor, I want to send a email notification to the Supervisor so they can approve the request.

So I thought, I would create the view, create the agent, and then schedule the agent to run at 1:00 AM on the that view but not all the documents. Am I missing something or is there a easier way?