DavidAbbott
asked on
Agent Not Running
Hi
We have just upgraded to the latest version of notes and a couple of agents do not run anymore, they are sheduled to run overnight and and as enabled on the server.
Any suggestions please
We have just upgraded to the latest version of notes and a couple of agents do not run anymore, they are sheduled to run overnight and and as enabled on the server.
Any suggestions please
R4 -> R7.0.2, R5 -> R7.0.2, R6 -> R7.0.2 or R7 -> R7.0.2 ??
ASKER
OK, i am running Notes 7, the agent log on all of the agents say that they have run, but they have'nt. I am allowed to run the agents
What do the agents do?
Go to the agent properties and under the security tab there is a drop down box for runtime security settings. You may have to change it from "do not allow restricted operations" to "Allow restricted operations" depending on what the agent does.
You might check this setting, it has gotten me a few times.
Go to the agent properties and under the security tab there is a drop down box for runtime security settings. You may have to change it from "do not allow restricted operations" to "Allow restricted operations" depending on what the agent does.
You might check this setting, it has gotten me a few times.
Did you check log.nsf, Miscellaneous? There might be a message there about the agent, e.g. why it stopped.
ASKER
"Go to the agent properties and under the security tab there is a drop down box for runtime security settings. You may have to change it from "do not allow restricted operations" to "Allow restricted operations" depending on what the agent does."s
they all show "Allow Restricted Operation"
they all show "Allow Restricted Operation"
How do you know they haven't run?
Add some print statments or log to a log file in various steps of the agent to show you progress. (ps. don't write to agent log, write to a log db.)
it may well be that they start, hit an error and exit.
Add some print statments or log to a log file in various steps of the agent to show you progress. (ps. don't write to agent log, write to a log db.)
it may well be that they start, hit an error and exit.
> it may well be that they start, hit an error and exit.
Indeed, it will result in an error message in the log.nsf database (unless you catch errors, but then ther should be a good error message).
Indeed, it will result in an error message in the log.nsf database (unless you catch errors, but then ther should be a good error message).
ASKER
no error message in the log that i can find!!!
And the agent's log itself (in the Designer) says that the agent ran? Date and time are correct?
Is it a local agent, or should it run on the server? Can you get to the server console or the Domino Admin client? Look at the Server Tasks, right-click the Agent Manager, Tell task..., and select a report for agents running today. Click OK and then Notes will crash :( at least, that's what happened here.
The alternative is a live console, and type
Tell Amgr Schedule
and
Tell Amgr Status
Is your agent there??
Is it a local agent, or should it run on the server? Can you get to the server console or the Domino Admin client? Look at the Server Tasks, right-click the Agent Manager, Tell task..., and select a report for agents running today. Click OK and then Notes will crash :( at least, that's what happened here.
The alternative is a live console, and type
Tell Amgr Schedule
and
Tell Amgr Status
Is your agent there??
Since you have to start the live console anyway, it's easier to type the commands above.
ASKER
does not seem to be any agents in there no
You wouldn't by any chance have renamed the server?
Look very carefully at the schedule again, to make sure that everything is set correctly. You must have done this a million times already by now...
Look very carefully at the schedule again, to make sure that everything is set correctly. You must have done this a million times already by now...
One more question: did your certifier change on Upgrade?
ASKER
Name was not changed no, we have only upgraded the clients and not the server, certifier changed on upgrade but i was re-certified
OK, that's the point. You have to save the Agent one more time to save the new signature with the Agent.
Also look for the new Options in names.nsf for the security tab of your server document for the section: "Programmability Restrictions"
Also look for the new Options in names.nsf for the security tab of your server document for the section: "Programmability Restrictions"
I think we're getting there... :)
ASKER
ok, edited and saved them, i will wait and see if they run overnight
Are they in the list now, Tell Amgr Schedule ??
ASKER
I go into the admin database and go into the live console and type in Tell Amgr Schedule and Tell Amgr Status etc, but nothing appears. Where am i going wrong?
When you see no response on the console, and when the console is black, did you press the green triangle to start the Console live?
ASKER
yes it is live, when i type in Tell Amgr Status it simple repeats the statement twice and then nothing other than normal traffic
You must get LOADS of text when you type that command. Please click on the Server Tasks, the first entry on the left. It is my guess that you can't find the Agent Manager there. I assume the Agent Manager hasn't been started, or it crashed and doesn't respond.
You have Admin rights on the server, I hope? Type a
Show Users
to verify that the console works for you.
You have Admin rights on the server, I hope? Type a
Show Users
to verify that the console works for you.
ASKER
Show Users- this works, it shows me all the user on the system
ASKER
how do i start the Agent Manager?
It should be started automatically. Open notes.ini on the server and look fr a line with ServerTasks. AMGR should be on it.
If it's not started, you can do that with
LOAD AMGR
If it's not started, you can do that with
LOAD AMGR
ASKER
when i type in LOAD AMGR it tells me another agent manage is running on the system and cannot allow 2, does that mean that the agent manager is working correctly at start up?
When i type in Tell Amgr Schedule it tells me about daytime agents etc, but i cannot see the overnight run and when i type in Tell Amgr Status it tells me the same
When i type in Tell Amgr Schedule it tells me about daytime agents etc, but i cannot see the overnight run and when i type in Tell Amgr Status it tells me the same
Good, it's running, you can see all tasks with
SHOW TASKS
You agent didn't run? When you look at the agents in the Designer, right-click your agent and select Log..., what's the result?
SHOW TASKS
You agent didn't run? When you look at the agents in the Designer, right-click your agent and select Log..., what's the result?
ASKER
on "show tasks" it states that - Agent Manager Executive "1" idle & Agent Manager Idle
When i go into designer and right click the agent it states the following:
"Started running agent 'BCSalesEmail' on 13/07/2006 01:01:06
Running on all documents in database: 3525 total
Found 3525 document(s) that match search criteria
Ran LotusScript code
Done running agent 'BCSalesEmail' on 13/07/2006 01:01:07"
When i go into designer and right click the agent it states the following:
"Started running agent 'BCSalesEmail' on 13/07/2006 01:01:06
Running on all documents in database: 3525 total
Found 3525 document(s) that match search criteria
Ran LotusScript code
Done running agent 'BCSalesEmail' on 13/07/2006 01:01:07"
Which says that it ran this morning at 01:01, which seems correct to me. So it ran indeed. By the way, running agents at 1 o'clock isn't done, because the server has a lot of housekeeping to do at that time. It is far better to run agents at 04:00 or even later, when the housekeeping chores have finished.
Now it gets time to spice up your code with log statements, that will leave their output in the agent log you've just seen.
At the start somewhere, put
Dim agentLog As New NotesLog("Agent log")
Call agentLog.OpenAgentLog
On every vital point, put a statement like
Call agentLog.LogAction("someth ing")
Now it gets time to spice up your code with log statements, that will leave their output in the agent log you've just seen.
At the start somewhere, put
Dim agentLog As New NotesLog("Agent log")
Call agentLog.OpenAgentLog
On every vital point, put a statement like
Call agentLog.LogAction("someth
End it with Call agentLog.Close
ASKER
sjef thanks will code it and let you know
ASKER
ok, agent log looks like the following now
Started running agent 'ASUSalesEmail' on 13/07/2006 14:04:03
Running on all documents in database: 3531 total
Found 3531 document(s) that match search criteria
13/07/2006 14:04:04: email Send to Doc Creator
13/07/2006 14:04:04: email Send to Doc Manager
13/07/2006 14:04:04: Looking for next document
13/07/2006 14:04:04: email Send to Doc Creator
13/07/2006 14:04:04: email Send to Doc Manager
13/07/2006 14:04:04: Looking for next document
13/07/2006 14:04:04: email Send to Doc Creator
13/07/2006 14:04:05: email Send to Doc Manager
13/07/2006 14:04:05: Looking for next document
Ran LotusScript code
Done running agent 'ASUSalesEmail' on 13/07/2006 14:04:05
Started running agent 'ASUSalesEmail' on 13/07/2006 14:04:03
Running on all documents in database: 3531 total
Found 3531 document(s) that match search criteria
13/07/2006 14:04:04: email Send to Doc Creator
13/07/2006 14:04:04: email Send to Doc Manager
13/07/2006 14:04:04: Looking for next document
13/07/2006 14:04:04: email Send to Doc Creator
13/07/2006 14:04:04: email Send to Doc Manager
13/07/2006 14:04:04: Looking for next document
13/07/2006 14:04:04: email Send to Doc Creator
13/07/2006 14:04:05: email Send to Doc Manager
13/07/2006 14:04:05: Looking for next document
Ran LotusScript code
Done running agent 'ASUSalesEmail' on 13/07/2006 14:04:05
QED: Agent Is Running! :)
To solve your next question, we'd like some code, please...
To solve your next question, we'd like some code, please...
ASKER
here is the code for one of agents:
Dim db As NotesDatabase
Dim session As NotesSession
Dim documents As NotesDocumentCollection
Dim doc, eMail As NotesDocument
Dim view As NotesView
Dim item As NotesItem
Dim rtitem, docrtitem As NotesRichTextItem
Dim nam As NotesName
Dim j As Integer
Sub Initialize
Dim agentLog As New NotesLog("Agent log")
Set session = New NotesSession
Set db=session.CurrentDatabase
Call agentLog.OpenAgentLog
Set view=db.getview("ASUSales" )
Set doc = view.GetFirstDocument
Do Until doc Is Nothing
Set email = New NotesDocument(db)
Set rtitem=New NotesRichTextItem(eMail, "Body")
email.SendTo=doc.Creator_S (0)
email.subject="Warning - Client " & doc.Contact(0) & "'s" &" ASU Sale Pending Which is Not Complete"
Call rtitem.AppendDocLink(doc, db.title)
rtitem.AppendText(" Please Click here: To link to ASU Sale which is pending for " & doc.Contact(0) & ". " & "This needs urgent attention, Ignoring it Might Well Result in a Lost Sale " & doc.DateCreated(0) )
Call email.Send(False)
Call agentLog.LogAction("email Send to Doc Creator")
Set email = New NotesDocument(db)
Set rtitem=New NotesRichTextItem(eMail, "Body")
email.SendTo=doc.FixedMana ger(0)
email.subject="Warning - Client " & doc.Contact(0) & "'s" &" ASU Sale Pending Which is Not Complete"
Call rtitem.AppendDocLink(doc, db.title)
rtitem.AppendText(" Please Click here: To link to ASU Sale which is pending for " & doc.Contact(0) & ". " & "This needs urgent attention, Ignoring it Might Well Result in a Lost Sale " & doc.DateCreated(0) )
Call email.Send(False)
Call agentLog.LogAction("email Send to Doc Manager")
Set doc = view.GetNextDocument(doc)
Call agentLog.LogAction("Lookin g for next document")
Loop
Call agentLog.Close
End Sub
Dim db As NotesDatabase
Dim session As NotesSession
Dim documents As NotesDocumentCollection
Dim doc, eMail As NotesDocument
Dim view As NotesView
Dim item As NotesItem
Dim rtitem, docrtitem As NotesRichTextItem
Dim nam As NotesName
Dim j As Integer
Sub Initialize
Dim agentLog As New NotesLog("Agent log")
Set session = New NotesSession
Set db=session.CurrentDatabase
Call agentLog.OpenAgentLog
Set view=db.getview("ASUSales"
Set doc = view.GetFirstDocument
Do Until doc Is Nothing
Set email = New NotesDocument(db)
Set rtitem=New NotesRichTextItem(eMail, "Body")
email.SendTo=doc.Creator_S
email.subject="Warning - Client " & doc.Contact(0) & "'s" &" ASU Sale Pending Which is Not Complete"
Call rtitem.AppendDocLink(doc, db.title)
rtitem.AppendText(" Please Click here: To link to ASU Sale which is pending for " & doc.Contact(0) & ". " & "This needs urgent attention, Ignoring it Might Well Result in a Lost Sale " & doc.DateCreated(0) )
Call email.Send(False)
Call agentLog.LogAction("email Send to Doc Creator")
Set email = New NotesDocument(db)
Set rtitem=New NotesRichTextItem(eMail, "Body")
email.SendTo=doc.FixedMana
email.subject="Warning - Client " & doc.Contact(0) & "'s" &" ASU Sale Pending Which is Not Complete"
Call rtitem.AppendDocLink(doc, db.title)
rtitem.AppendText(" Please Click here: To link to ASU Sale which is pending for " & doc.Contact(0) & ". " & "This needs urgent attention, Ignoring it Might Well Result in a Lost Sale " & doc.DateCreated(0) )
Call email.Send(False)
Call agentLog.LogAction("email Send to Doc Manager")
Set doc = view.GetNextDocument(doc)
Call agentLog.LogAction("Lookin
Loop
Call agentLog.Close
End Sub
ASKER
The agent runs fine if i manually make it run, it is just the overnight run that seems to be a problem
The log you supplied above, was that from running manually, or by the server?
Apart from some semantics errors, I see no grave problems. Strange that you send two independent mails, isn't necessary: SendTo can be an array.
Apart from some semantics errors, I see no grave problems. Strange that you send two independent mails, isn't necessary: SendTo can be an array.
ASKER
the results were from a manual run and not by the server, and yes i agree the coding is messy
Not messy! Not at all, but it could be simpler, like this (for free ;)
Dim db As NotesDatabase
Dim session As NotesSession
Dim documents As NotesDocumentCollection
Dim doc As NotesDocument
Dim eMail As NotesDocument
Dim view As NotesView
Dim item As NotesItem
Dim rtitem As NotesRichTextItem
Dim docrtitem As NotesRichTextItem
Dim nam As NotesName
Dim j As Integer
Dim addrs(1) As String
Sub Initialize
Dim agentLog As New NotesLog("Agent log")
Set session = New NotesSession
Set db=session.CurrentDatabase
Call agentLog.OpenAgentLog
Set view=db.getview("ASUSales" )
Set doc = view.GetFirstDocument
Do Until doc Is Nothing
Set email = New NotesDocument(db)
Set rtitem=New NotesRichTextItem(eMail, "Body")
addrs(0)= doc.Creator_S(0)
addrs(1)= doc.FixedManager(0)
email.SendTo= addrs
email.subject="Warning - Client " & doc.Contact(0) & "'s" &" ASU Sale Pending Which is Not Complete"
Call rtitem.AppendDocLink(doc, db.title)
rtitem.AppendText(" Please Click here: To link to ASU Sale which is pending for " & doc.Contact(0) & ". " & "This needs urgent attention, Ignoring it Might Well Result in a Lost Sale " & doc.DateCreated(0) )
Call email.Send(False)
Call agentLog.LogAction("email Sent")
Set doc = view.GetNextDocument(doc)
Call agentLog.LogAction("Lookin g for next document")
Loop
Call agentLog.Close
End Sub
But that's beside the point. What you can do is Disable the agent, and immediately afterwards Enable it again. The server will treat that as a trigger, so it will start the agent.
Dim db As NotesDatabase
Dim session As NotesSession
Dim documents As NotesDocumentCollection
Dim doc As NotesDocument
Dim eMail As NotesDocument
Dim view As NotesView
Dim item As NotesItem
Dim rtitem As NotesRichTextItem
Dim docrtitem As NotesRichTextItem
Dim nam As NotesName
Dim j As Integer
Dim addrs(1) As String
Sub Initialize
Dim agentLog As New NotesLog("Agent log")
Set session = New NotesSession
Set db=session.CurrentDatabase
Call agentLog.OpenAgentLog
Set view=db.getview("ASUSales"
Set doc = view.GetFirstDocument
Do Until doc Is Nothing
Set email = New NotesDocument(db)
Set rtitem=New NotesRichTextItem(eMail, "Body")
addrs(0)= doc.Creator_S(0)
addrs(1)= doc.FixedManager(0)
email.SendTo= addrs
email.subject="Warning - Client " & doc.Contact(0) & "'s" &" ASU Sale Pending Which is Not Complete"
Call rtitem.AppendDocLink(doc, db.title)
rtitem.AppendText(" Please Click here: To link to ASU Sale which is pending for " & doc.Contact(0) & ". " & "This needs urgent attention, Ignoring it Might Well Result in a Lost Sale " & doc.DateCreated(0) )
Call email.Send(False)
Call agentLog.LogAction("email Sent")
Set doc = view.GetNextDocument(doc)
Call agentLog.LogAction("Lookin
Loop
Call agentLog.Close
End Sub
But that's beside the point. What you can do is Disable the agent, and immediately afterwards Enable it again. The server will treat that as a trigger, so it will start the agent.
ASKER
ok i will try that
ASKER
OK, on inspection this morning the agent log on the agent with the new checking code is as follows:
Started running agent 'ASUSalesEmail' on 13/07/2006 17:44:00
Running on all documents in database: 3532 total
Found 3532 document(s) that match search criteria
13/07/2006 17:44:02: email Sent
13/07/2006 17:44:02: Looking for next document
13/07/2006 17:44:02: email Sent
13/07/2006 17:44:02: Looking for next document
13/07/2006 17:44:03: email Sent
13/07/2006 17:44:03: Looking for next document
Ran LotusScript code
Done running agent 'ASUSalesEmail' on 13/07/2006 17:44:03
you will note the run time on the server has changed, but still no documents created
Started running agent 'ASUSalesEmail' on 13/07/2006 17:44:00
Running on all documents in database: 3532 total
Found 3532 document(s) that match search criteria
13/07/2006 17:44:02: email Sent
13/07/2006 17:44:02: Looking for next document
13/07/2006 17:44:02: email Sent
13/07/2006 17:44:02: Looking for next document
13/07/2006 17:44:03: email Sent
13/07/2006 17:44:03: Looking for next document
Ran LotusScript code
Done running agent 'ASUSalesEmail' on 13/07/2006 17:44:03
you will note the run time on the server has changed, but still no documents created
Documents created? There are no documents created, only mails. The mails are sent (hopefully) and then discarded. To get some proof, add
email.CopyTo= "David Abbott/ABC"
to the document to be mailed, or use BlindCopyTo to keep yourself hidden.
I assume mails are sent. That you can verify in the log database, under Mail Routing Events. Look at yesterday at 17:44, you should see 3 (or 6) mails passing by there. If you don't see them, open the mail.box (there may be more) and check that, maybe they are pending delivery, for some odd reason. But that's a new chapter.
The agent runs :)
email.CopyTo= "David Abbott/ABC"
to the document to be mailed, or use BlindCopyTo to keep yourself hidden.
I assume mails are sent. That you can verify in the log database, under Mail Routing Events. Look at yesterday at 17:44, you should see 3 (or 6) mails passing by there. If you don't see them, open the mail.box (there may be more) and check that, maybe they are pending delivery, for some odd reason. But that's a new chapter.
The agent runs :)
ASKER
Sorry, you are correct no docs have been created, only mails sent, but, i am the FixedManager, so a copy would be sent to me and there is none, but if i run it manually i get loads.
Now it gets stranger as i have looked at the Mail Routing Events and the following was recorded
13/07/2006 17:44:05 Router: Message 005BEBA0 delivered to David Abbott/MAS
13/07/2006 17:44:05 Router: Message 005BEC52 delivered to David Abbott/MAS
13/07/2006 17:44:05 Router: Message 005BEC65 delivered to David Abbott/MAS
Nothing in the mail.box
Now it gets stranger as i have looked at the Mail Routing Events and the following was recorded
13/07/2006 17:44:05 Router: Message 005BEBA0 delivered to David Abbott/MAS
13/07/2006 17:44:05 Router: Message 005BEC52 delivered to David Abbott/MAS
13/07/2006 17:44:05 Router: Message 005BEC65 delivered to David Abbott/MAS
Nothing in the mail.box
And you didn't receive mails yesterday, at 17:44??
Just an overview:
- agent runs
- agent sends mail
- Domino says mails are sent
- id. mails are deliverd
- no mail in your mail database??
Do you have multiple mail databases? What's the name of the mail database on the server, and is it the same name as the one in your Person document? Do you look at a different replica of your mail database, because mail is usually delivered by a different server? Do you have a twin brother with the same name?
Just an overview:
- agent runs
- agent sends mail
- Domino says mails are sent
- id. mails are deliverd
- no mail in your mail database??
Do you have multiple mail databases? What's the name of the mail database on the server, and is it the same name as the one in your Person document? Do you look at a different replica of your mail database, because mail is usually delivered by a different server? Do you have a twin brother with the same name?
ASKER
twin brother lol
i understand what you are saying, but i assume the routing is not a problem as i get them when the manual run has been executed
i understand what you are saying, but i assume the routing is not a problem as i get them when the manual run has been executed
So, did you get the mails at 17:44? [No]
Then where did they go, as they were "delivered"?
Then where did they go, as they were "delivered"?
ASKER
Ok, i have set the agent to run more then once daily, and the following is the log entry:
Started running agent 'ASUSalesEmail' on 14/07/2006 13:09:01
Running on all documents in database: 3533 total
Found 3533 document(s) that match search criteria
Ran LotusScript code
Done running agent 'ASUSalesEmail' on 14/07/2006 13:09:01
When i run the agent manually this is the log entry:
Started running agent 'ASUSalesEmail' on 14/07/2006 13:13:41
Running on all documents in database: 3533 total
Found 3533 document(s) that match search criteria
14/07/2006 13:13:41: email Sent
14/07/2006 13:13:41: Looking for next document
14/07/2006 13:13:41: email Sent
14/07/2006 13:13:41: Looking for next document
Ran LotusScript code
Done running agent 'ASUSalesEmail' on 14/07/2006 13:13:41
Bit of a difference there!
Started running agent 'ASUSalesEmail' on 14/07/2006 13:09:01
Running on all documents in database: 3533 total
Found 3533 document(s) that match search criteria
Ran LotusScript code
Done running agent 'ASUSalesEmail' on 14/07/2006 13:09:01
When i run the agent manually this is the log entry:
Started running agent 'ASUSalesEmail' on 14/07/2006 13:13:41
Running on all documents in database: 3533 total
Found 3533 document(s) that match search criteria
14/07/2006 13:13:41: email Sent
14/07/2006 13:13:41: Looking for next document
14/07/2006 13:13:41: email Sent
14/07/2006 13:13:41: Looking for next document
Ran LotusScript code
Done running agent 'ASUSalesEmail' on 14/07/2006 13:13:41
Bit of a difference there!
ASKER
sorry forgot to mention, when the agent runs manually i get the emails and when it runs by itself I don't
Heh. Funny.
The view ASUSales wouldn't happen to have some special reader rights, or the documents in the view? Does the server itself have rights to get the view? The only thing that can explain the short log is the absence of documents in the view, to the server that is. Is that view a private view maybe? Or something else is ooto (out of the ordinary)?
The view ASUSales wouldn't happen to have some special reader rights, or the documents in the view? Does the server itself have rights to get the view? The only thing that can explain the short log is the absence of documents in the view, to the server that is. Is that view a private view maybe? Or something else is ooto (out of the ordinary)?
ASKER
the view is not private, it is hidden, it is open to all readers and above, and it has docs in the view, and nothing looks ooto
ASKER
please don't tell me my first job of each day is to manually run the agents!!!! UUUHHHHHHH
Ah, no, that's when you assume a managerial position, and you hire someone to do that for you. Problem solved. :)
Why does the server see no documants at all in that view? Maybe there are more views with the same name?? Run some checks, f.c.o.l., take some initiative! Think, Lewis, think!
There must be a perfectly sound reason (apart from a corrupt database) that the server is blind for the documents in that view.
Why does the server see no documants at all in that view? Maybe there are more views with the same name?? Run some checks, f.c.o.l., take some initiative! Think, Lewis, think!
There must be a perfectly sound reason (apart from a corrupt database) that the server is blind for the documents in that view.
ASKER
i have booked the server in for an eye test
By the NHS? Hmm, right... ;)
If need be, create just another very simple agent, that opens the view, reports how many documents are in there, reports also what the Universal-ID of view is, so you can verify whether the agent is barking up the wrong view.
If need be, create just another very simple agent, that opens the view, reports how many documents are in there, reports also what the Universal-ID of view is, so you can verify whether the agent is barking up the wrong view.
ASKER
SIMPLE?
If it pleases you, you may create a complex agent...
Make a copy if the current agent, also scheduled etc, and put the following code in it:
Sub Initialize
Dim db As NotesDatabase
Dim session As NotesSession
Dim doc As NotesDocument
Dim view As NotesView
Dim n As Integer
Dim agentLog As New NotesLog("Agent log")
Set session = New NotesSession
Set db=session.CurrentDatabase
Call agentLog.OpenAgentLog
Set view=db.getview("ASUSales" )
Call agentlog.LogAction("ASUSal es-id: " & view.UniversalID)
Set doc = view.GetFirstDocument
Do Until doc Is Nothing
n= n + 1
Set doc = view.GetNextDocument(doc)
Loop
Call agentlog.LogAction("docume nts found in view ASUSales: " & n)
Call agentLog.Close
End Sub
Wait till it has run by the server, save the output somewhere, then run it manually. If you want to receive the report by mail, that's also possible: replace the line with OpenAgentLog with
Call agentLog.OpenMailLog("Davi d Abbott/MAS", "Test agent log")
Sub Initialize
Dim db As NotesDatabase
Dim session As NotesSession
Dim doc As NotesDocument
Dim view As NotesView
Dim n As Integer
Dim agentLog As New NotesLog("Agent log")
Set session = New NotesSession
Set db=session.CurrentDatabase
Call agentLog.OpenAgentLog
Set view=db.getview("ASUSales"
Call agentlog.LogAction("ASUSal
Set doc = view.GetFirstDocument
Do Until doc Is Nothing
n= n + 1
Set doc = view.GetNextDocument(doc)
Loop
Call agentlog.LogAction("docume
Call agentLog.Close
End Sub
Wait till it has run by the server, save the output somewhere, then run it manually. If you want to receive the report by mail, that's also possible: replace the line with OpenAgentLog with
Call agentLog.OpenMailLog("Davi
ASKER
OK, thanks, this is the output when run by the server
Started running agent 'TEST' on 14/07/2006 17:28:00
Running on new or modified documents: 3534 total
Found 3534 document(s) that match search criteria
Ran LotusScript code
Done running agent 'TEST' on 14/07/2006 17:28:00
This is the output when manually run
Started running agent 'TEST' on 14/07/2006 17:29:04
Running on new or modified documents: 3534 total
Found 3534 document(s) that match search criteria
14/07/2006 17:29:04: ASUSales-id: 10A8BCAEE0499D2A8025718500 4D9F9B
14/07/2006 17:29:05: documents found in view ASUSales: 2
Ran LotusScript code
Done running agent 'TEST' on 14/07/2006 17:29:05
Started running agent 'TEST' on 14/07/2006 17:28:00
Running on new or modified documents: 3534 total
Found 3534 document(s) that match search criteria
Ran LotusScript code
Done running agent 'TEST' on 14/07/2006 17:28:00
This is the output when manually run
Started running agent 'TEST' on 14/07/2006 17:29:04
Running on new or modified documents: 3534 total
Found 3534 document(s) that match search criteria
14/07/2006 17:29:04: ASUSales-id: 10A8BCAEE0499D2A8025718500
14/07/2006 17:29:05: documents found in view ASUSales: 2
Ran LotusScript code
Done running agent 'TEST' on 14/07/2006 17:29:05
Ah, that tells me more. Two possibilities: either we're not talking about the same agent (0% prob.) or there is a message in the Miscellaneous Events section of the log.nsf database for the server. The huge difference between the two outputs is the lines with 14/07/2006 etc. There are no such lines at all in the first output. And that can only happen when the agent isn't allowed to run. AFAIK there are no restricted operations in the simple agent, so security settings in the Agent Properties aren't important.
Back to square three: Security :-S
Open log database of the server, Miscellaneous, 14/07/2006 17:28
Are there ANY messages from the Agent Manager about agent TEST??
Back to square three: Security :-S
Open log database of the server, Miscellaneous, 14/07/2006 17:28
Are there ANY messages from the Agent Manager about agent TEST??
ASKER
Ahhh, we might be geting somewhere
14/07/2006 17:28:00 AMgr: Agent ('TEST' in 'ACT\mortgagec.nsf') error message: Object variable not set
14/07/2006 17:28:23 Opened session for David Abbott/mortgageadvisoryser vices (Release 7.0.1)
14/07/2006 17:28:24 Closed session for David Abbott/mortgageadvisoryser vices
Databases accessed: 1 Documents read: 0 Documents written: 0
14/07/2006 17:28:00 AMgr: Agent ('TEST' in 'ACT\mortgagec.nsf') error message: Object variable not set
14/07/2006 17:28:23 Opened session for David Abbott/mortgageadvisoryser
14/07/2006 17:28:24 Closed session for David Abbott/mortgageadvisoryser
Databases accessed: 1 Documents read: 0 Documents written: 0
Finally! :-)) But strange that it runs when started manually.
Some additional lines in your agent, so we can see where it crashes...
Sub Initialize
Dim db As NotesDatabase
Dim session As NotesSession
Dim doc As NotesDocument
Dim view As NotesView
Dim n As Integer
On Error Goto onerror
Dim agentLog As New NotesLog("Agent log")
Set session = New NotesSession
Set db=session.CurrentDatabase
' Call agentLog.OpenAgentLog
Call agentLog.OpenMailLog("Davi d Abbott/MAS", "Test agent log")
Set view=db.getview("ASUSales" )
Call agentlog.LogAction("ASUSal es-id: " & view.UniversalID)
Set doc = view.GetFirstDocument
Do Until doc Is Nothing
n= n + 1
Set doc = view.GetNextDocument(doc)
Loop
Call agentlog.LogAction("docume nts found in view ASUSales: " & n)
exitsub:
Call agentLog.Close
Exit Sub
onerror:
Call agentlog.LogAction("Error " & Error$ & " on line " & Erl)
Resume exitsub
End Sub
Some additional lines in your agent, so we can see where it crashes...
Sub Initialize
Dim db As NotesDatabase
Dim session As NotesSession
Dim doc As NotesDocument
Dim view As NotesView
Dim n As Integer
On Error Goto onerror
Dim agentLog As New NotesLog("Agent log")
Set session = New NotesSession
Set db=session.CurrentDatabase
' Call agentLog.OpenAgentLog
Call agentLog.OpenMailLog("Davi
Set view=db.getview("ASUSales"
Call agentlog.LogAction("ASUSal
Set doc = view.GetFirstDocument
Do Until doc Is Nothing
n= n + 1
Set doc = view.GetNextDocument(doc)
Loop
Call agentlog.LogAction("docume
exitsub:
Call agentLog.Close
Exit Sub
onerror:
Call agentlog.LogAction("Error " & Error$ & " on line " & Erl)
Resume exitsub
End Sub
I still think it's the view that the server can't open, or maybe the first document that has a Readers-field.
ASKER
Ok when run manually
Started running agent 'ASUSalesEmail' on 16/07/2006 13:54:05
Running on all documents in database: 3535 total
Found 3535 document(s) that match search criteria
Ran LotusScript code
Done running agent 'ASUSalesEmail' on 16/07/2006 13:54:06
Email message on manual run
16/07/2006 13:54:05 Agent log starting
16/07/2006 13:54:05 ASUSales-id: 10A8BCAEE0499D2A8025718500 4D9F9B
16/07/2006 13:54:05 documents found in view ASUSales: 2
When run by server
Started running agent 'ASUSalesEmail' on 16/07/2006 13:59:50
Running on all documents in database: 3535 total
Found 3535 document(s) that match search criteria
Ran LotusScript code
Done running agent 'ASUSalesEmail' on 16/07/2006 13:59:50
Email message on server run
16/07/2006 14:05:00 Agent log starting
16/07/2006 14:05:00 Error Object variable not set on line 16
Started running agent 'ASUSalesEmail' on 16/07/2006 13:54:05
Running on all documents in database: 3535 total
Found 3535 document(s) that match search criteria
Ran LotusScript code
Done running agent 'ASUSalesEmail' on 16/07/2006 13:54:06
Email message on manual run
16/07/2006 13:54:05 Agent log starting
16/07/2006 13:54:05 ASUSales-id: 10A8BCAEE0499D2A8025718500
16/07/2006 13:54:05 documents found in view ASUSales: 2
When run by server
Started running agent 'ASUSalesEmail' on 16/07/2006 13:59:50
Running on all documents in database: 3535 total
Found 3535 document(s) that match search criteria
Ran LotusScript code
Done running agent 'ASUSalesEmail' on 16/07/2006 13:59:50
Email message on server run
16/07/2006 14:05:00 Agent log starting
16/07/2006 14:05:00 Error Object variable not set on line 16
And line 16 is...
I s'pose it is the line with
Call agentlog.LogAction("ASUSal es-id: " & view.UniversalID)
Perfect. That means that view has no value, view must be Nothing here. And that can only happen when the server isn't allowed to open the view. Check the view again, for special permissions etc. And check what the server's rights are in the database.
Call agentlog.LogAction("ASUSal
Perfect. That means that view has no value, view must be Nothing here. And that can only happen when the server isn't allowed to open the view. Check the view again, for special permissions etc. And check what the server's rights are in the database.
ASKER
I have added the server individually on both the view and the database itself and still the same error message
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
OK, have looked at it a bit closer. Problem Solved.......
The view was hidden and the code was not reflecting this, have changed the code and it now works, Thank you very much for your help
The view was hidden and the code was not reflecting this, have changed the code and it now works, Thank you very much for your help
Thanks! :-))
View hidden? Make it a good habit to give EVERY view an alias, and use ONLY that alias in your code. That way, you'll never have problems with view names. Or was it hidden from Notes?
View hidden? Make it a good habit to give EVERY view an alias, and use ONLY that alias in your code. That way, you'll never have problems with view names. Or was it hidden from Notes?
ASKER
I have changed them to have alias's, thanks for advice
:) By the way, this is post 72 in this question... See you next time!
2.) Look into server document for Groups allowed to run unrestricted agents.