Solved

Run schedule agent on specific view

Posted on 2008-06-09
4
228 Views
Last Modified: 2013-12-18
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?
0
Comment
Question by:kali958
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 63

Expert Comment

by:SysExpert
ID: 21746676
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 !
0
 
LVL 7

Accepted Solution

by:
olaraak earned 500 total points
ID: 21747008
Think you just miss the last row, to run agent after you got it:

Agent.Run()

:-)
This function returns Integer; 0=success

it can be used like:

If Agent.Run()=0 Then
   Print "Agent ""Supervisor"" ran successfully"
Else
  Print "Some kind of error occurred"
End If

On the other hand,

1.  the agent Supervisor trigger can be changed to schedule
2. it would be simpler  to use Simple actions in one agent to run another
3. or use @Command( [RunAgent] ; "Supervisor ") instead of LotusSript

But yes, the Agent.Run() should also do.
0
 
LVL 7

Expert Comment

by:olaraak
ID: 21747041
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?
0
 

Author Comment

by:kali958
ID: 21750345
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?
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Lotus notes forward mail problem 5 454
Event in Notes Form after open and visible 10 231
Lotus Domino 9 web server 6 101
@Mailsend 3 95
Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question