Do not use on any
shared computer
August 29, 2008 03:50pm pdt
 
[x]
Attachment Details

Scheduled Agent Not Working

Zone: Lotus Notes
Tags: IBM, Lotus Notes, 6.5.x, Lotusscript, N/A
Max points on this one, Experts.

I have an agent that works fine when activated in the UI, but not as a scheduled agent.  I believe I have removed all references to any UI coding, and the agent log shows it as having run without error, yet...the results that take place when run manually do not happen when run scheduled.

I realize that this code could be written far more efficiently, as I had forgotten about the UnprocessedDocuments property when I wrote this (it's been a little while with my Lotusscript skills); additionally, I need to reacquaint myself with FTSearch.  Still, while inefficient, I do not see barriers to the script performing on a scheduled basis rather than a manual one.


WHAT THE CODE SHOULD DO:
Essentially, what should happen (and DOES happen when run via a button) is that the database ACL entries are scanned to see which users have the "[Forum]" role.  If they do, then a search is done of all documents in particular view based on other matching criteria, and those documents matching are placed in a folder noted in the acl entry's profile document.  Again, this happens when I call the agent from a button; but when run on a scheduled basis, the documents are not placed into these folders.

SERVER RIGHTS AND AGENT LOG:
According to the log, the agent is running and I get no error messages in the log mentioning limited rights. Remote bugging is not turned on, and I just began this work for a multinational organization and am still trying to establish a relationship with my server admins, so I don't yet have much recourse there. Here is the text from the agent log:

Started running agent 'FindNewSubs' on 07/01/2008 08:23:29 PM
Running on all documents in database: 1084 total
Found 1084 document(s) that match search criteria
Ran LotusScript code
Done running agent 'FindNewSubs' on 07/01/2008 08:23:30 PM

I'll attach here the code snippet.  Feel free, All, to have at my code and point out any flaws even if they do not pertain to the question; I've no pride here whatsoever, and have already nailed the planks together and assumed the position :-)

Thanks to all who respond
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
Sub Initialize
	Dim session As New NotesSession
	Dim db As NotesDatabase
	Dim view As NotesView
	Dim acl As NotesACL
	Dim aclEntry As NotesACLEntry
	Dim vc As NotesViewEntryCollection
	Dim fdoc  As NotesViewEntry
	Dim bdoc As NotesDocument
	Dim pView As NotesView
	Dim pDoc As NotesDocument
	Dim pItem As NotesItem	
	Dim vItem As NotesItem
	Dim tf As String
 
	Set db = session.CurrentDatabase
	Set view = db.GetView("(byProduct)")	
	Set acl = db.ACL
	Set aclentry = ACL.GetFirstEntry	
	Goto FindForumMembers
	
PutDocsInFolder:	
	Forall role In aclentry.roles
		Set vc = view.GetAllEntriesByKey(role)
		Set fdoc = vc.GetFirstEntry	
		Do While Not fdoc Is Nothing
			Set bdoc = fdoc.Document
			Set vitem = bdoc.GetFirstItem("lstVoters")
			p = vitem.contains(aName) 
			If p = False Then
			   Call bdoc.PutInFolder( tf)		
			End If
			Set fdoc = vc.GetNextEntry(fdoc)	
		Loop
	End Forall		
	Return
	
FindForumMembers:
	Do While Not aclentry Is Nothing
		Forall role In aclentry.Roles
			aName = aclentry.name
			Select Case role
			Case Is = "[Forum]"			
				Set pView = db.GetView("Profiles")
				Set pDoc = pview.GetDocumentByKey(aName)
				Set pItem = pdoc.GetFirstItem("txtSubFolder")
				tf = pItem.text
				Gosub PutDocsInFolder
				Exit Forall
			End Select
		End Forall
		Set aclEntry= acl.GetNextEntry(aclentry)	
	Loop	
End Sub
Start your free trial to view this solution
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

Question Stats
Zone: Software
Question Asked By: sprice205
Solution Provided By: Bill-Hanson
Participating Experts: 3
Solution Grade: A
Views: 4
Translate:
Loading Advertisement...
 
[+][-]Accepted Solution by Bill-Hanson

Rank: Wizard

Accepted Solution by Bill-Hanson:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by sprice205
Author Comment by sprice205:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Expert Comment by Bill-Hanson

Rank: Wizard

Expert Comment by Bill-Hanson:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by sprice205
Author Comment by sprice205:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Expert Comment by SysExpert

Rank: Sage

Expert Comment by SysExpert:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by sprice205
Author Comment by sprice205:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Open Discussion
Open Discussion
 
Comment by codeguru14
Hi Experts,

I have similar problem.. This is totally unrelated to the code attached above by Sprice ..

There are several scheduled agents (say 50) on a particular server . All the agents are signed by the user-Id which has all the necessary rights to run these scheduled agents.

These agents were running as per the schedule since a long time (in months) , suddenly these all stopped running. I mean all 50 of them .. :(

Singer ID is correct , No changes made in Server document , No changes made in the server setting
No changes in the agent properties too. There is nothing in Log.nsf which can give me hint.

What could be the possible reason behind this sudden event ?

--

Temporary solution : Server was rebooted , and the agents started runnning again .




Now similar situation..

The scenario is the same as above, but this time 25 of scheduled agents stopped running , other 25 are running OK ..


---

Temporary solution : Server was rebooted and agents started running fine ..






That brings the question , is there any setting or any process on the server side which handles these agents and could cause the above problem ?

Please let me know if you need any other information.


 
 
20080723-EE-VQP-34 / EE_QW_2_20070628