I have an agent that creates new documents that summarize data from existing (data) docs. When I run the agent manually (from the Actions menu) everything works properly…new summary documents are created. When I schedule the agent, the new summary docs are not saved.
The code looks like this:
'Delete all existing summary docs…
'Get a collection of existing (data) docs…
'For each (data) doc in the collection, gather some stats…
Set newDoc = New NotesDocument(db)
newDoc.Form = “summary”
'Set some more field values…
Call newDoc.Save(True, False)
I have traced the agent during the scheduled run, and the only thing failing is the doc.Save call. I.E. the new document exists in memory (and it’s field values can be referenced), but these new docs are never writen to disk.
I have been assuming this is a permission problem, so I have tried:
-
setting “run on behalf of” to the administrator’s account
-
set runtime security level = 3
-
default access for running this agent = all readers and above
Nothing seems to work…any suggestions?
Subject: Agent creating new docs…not saving when scheduled
Did you read the articles about agent security in the Agent FAQ? It should help you figure out what you needs to be set to have this agent run. The rights has to be given in the server record. “Troubleshooting agents in R5 and r6” and “decoding agents in R6” are two good articles to start. The links are in the Agent FAQ or in the article arhives of LDD.
Some of the things you have tried will abort the running of the agent instantly. To set “on behalf” value, you need to have very high priority. Setting the field to administrator name in the deisgner is not going to give you the rights of the administrator, quite the opposite, your agent execution will not even start.
Setting priority level high in the agent when you really don’t have those rights, again will not even allow your agent to start because the system detects that someone is trying to get more rights then they were given.
Subject: RE: Agent creating new docs…not saving when scheduled
The thing is, the agent DOES run, and through careful tracing, I have proven that it does not fail anywhere except on the call to save the new document.
“Setting the field to administrator name in the deisgner is not going to give you the rights of the administrator, quite the opposite, your agent execution will not even start”
- Not true…in fact the agent DOES run AND completes every task (including the deletion of existing summary docs) except that it does not save the new document it is trying to create (even though I have proven that the doc does exist in memory, i.e. it has been created and the fields are populated)…the new doc is simply not being written to disk.
I will check out the FAQs you suggest, but at this point I do not think that the issues you raised are valid in this case.
Thanks for you help.
Subject: RE: Agent creating new docs…not saving when scheduled
Strangely enough, this just started happening to my scheduled agents as well. I’ve run these manually and the documents get updated as expected but when scheduled, everything process but the save call. I have read all the suggested posts and checked the signatures, Agent restrictions, logs, etc. and there doesn’t seem to be an explanation. Since this post is over a year old, I’m hoping you can remember what resolved your issue at the time.
Thanks,
Tina
Subject: Agent creating new docs…not saving when scheduled
Check that the signature on the agent is allowed to create documents in the database? are there any author fields?
Subject: RE: Agent creating new docs…not saving when scheduled
I have signed the agent with the administrator’s id. This id has complete rights to the server…there is nothing that user cannot do.
There are no author fields (explicitly set my be) on the new form (that cannot be saved).