Standalone Lotus Notes Agents Do Not Run

I have recently written an agent in Lotus Notes to simply display a messagebox that the message has arrived. If I test the agent, Lotus Notes reports back a message box just as programmed. However, it does not run automatically in Notes when an email has arrived. Thinking that maybe the agent cannot print up a message box I copied some agent code (off the web) to copy the incoming mail to a folder. Still nothing.  Assume I have no knowledge in Lotus Notes my tasks are:

1. Send an HTML email out through Lotus Notes.
2. Capture and incoming mail and process the salient information to a file.
3. Book an appointment in Lotus Notes.
4. Retrieve a set of appointments between dates in Lotus Notes.

I am using Lotus Notes as a standalone application rather than connecting to domino. Since it is a local agent I am assuming that there should be no problem but as yet nothing no glimmer of success.

Thanks in advance.
chafford100Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Sjef BosmanGroupware ConsultantCommented:
Scheduled local agents are enabled? See File/Preferences/User preferences, at the right.

If you do not have Lotus Notes knowledge, as you say, your tasks will be difficult. You may need professional help, or a developer training.

How did you code your agent?
0
chafford100Author Commented:
To add a little more colour: I downloaded the trial version of Lotus Notes from IBM which is version 8 (this agent is part of a large system we are developing for a client in .net but we need Lotus integration - they are using version 5 Lotus Notes).

I opened up the mail database in domino designer and clicked on the agents and added a new agent. I selected After mail has arrived. I selected it to be a private agent and selected LotusScript. In the Initialize I had one line which was MsgBox("New Mail Arrived"). I tested the agent (using the run feature and it worked fine). Then I closed off Domino Designer, closed off Lotus Notes and reopened Notes. Nothing happens (I read somewhere that the process could take 3-5 minutes to respond to new email arriving).

I consider myself an expert in .NET/COM so I am ultimately wanting to do the best approach and if this means one line of Lotus Code and a .net library then so be it.

Thanks again.
0
chafford100Author Commented:
Hi again,

"Scheduled local agents are enabled? See File/Preferences/User preferences, at the right." Cannot even see this? Where would it be. I have File/Preferences and then the screen as attached.
0
Learn Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

chafford100Author Commented:
Here is the screenshot for some reason did not attach.
Image1.jpg
0
Sjef BosmanGroupware ConsultantCommented:
Whoah! The preferences have changed to R8, I must confess I've never seen the interior yet of R8. I suppose it's on the second topic on the left, Basic Notes Client Config. In older versions, one could enable or disable local agents. Maybe that still can be set somewhere?

Back to your first post:
1) HTML mail can be produced, you'd have to use the MIME stuff in R7. http://news4notes.com/web/dokumente/notesnews20051214115434.html
2) That would be your agent
3) To create an appointment, create an Appointment-document. See the fields and their values in a manually created appointment document, and mimic that. Example: http://searchdomino.techtarget.com/tip/0,289483,sid4_gci1212486,00.html
4) Retrieve would be a Search, but what to do with the results?

Remarks:
a) it could be different in R8
b) next time, you'd better ask 4 different question of 125 points each; each question may then get more specific attention (just a hint...)
0
chafford100Author Commented:
Thanks very much:
And so we continue:

1. Will check out the link but the solution must work with R5. What I was thinking is to take the HTML and pass it through a HTML->RTF converter. do you know of an R5 working solution.
2. Indeed it would be the agent. Do you have a code snippet for this in terms of parsing the incoming email 1 by 1. What I would really like to do is have the agent interface with a COM component and I will read all the information off - is this doable.
3. Thanks for the info will check it out.
4. What I want to do is read the appointments and pull out the start time/endtime subject, content etc and read it into another calendar control. therefore I really need to serialise the fields. any snippets.

Remarks:
a) I am developing for R5 so all items must work in R5.
b) Sorry newbie at this but now I know I will post the questions separately.

Will check all this out.

Thanks.
0
Sjef BosmanGroupware ConsultantCommented:
1) first verify that the HTML-solution isn't for R5 as well; there are other solutions probably, maybe someone else here knows one??
2) COM-component? Out of my league... :-|  And it depends a lot on the format of the mail. The content of the mail is directly available, in the Body field. No need to use COM, I think. But if real parsing is required... Is it a special language those mails arrive in??
4) So the appointments are to be selected and then exported to some other format? You could use a view in Notes and then walk through that view.

a) then get an R5 development environment, on the double! R8 is much better, but has many more functions and the object model is a lot richer. Be careful if you continu, since converting back to R5 may be a time-consuming disappointment.
b) next time.. next time...
0
chafford100Author Commented:
Just back on the agent: I set the checkbox to enable scheduled agents but still nothing. Is there a sure fire way of writing something in the after mail has arrived event that I can confirm it is working.

Is there anything on the standalone. Would the domino server be doing the running of these agents. I would've expected locally but I would not know.

Any place to download R5. Have checked the IBM site - nothing.
0
fgrushevskyCommented:
"After new mail arrived" agent will be executed only mail arrives and you can't reproduce it in standalone mode.
Change agent trigger to be "scheduled", click "schedule" button and schedule it run like every 5 minues, click "target" button and set it to "all new documents"

You also need to be aware that UI functions such as Messagebox etc will not work in back-end agents and your agent is back-end agent
If you change your agent to put mail in folders intead of messagebox it will work
0
chafford100Author Commented:
Are you saying that a standalone version of Lotus Notes will not perform these agents or it will?

As for the agent, have you got a code snippet I can put into the Initialize portion of the agent (say for example it writes an entry to a text file that a document has arrived) so that I know that the agent system is working?

Being very new to Notes I have been scratching my head on this issue for days now.
0
fgrushevskyCommented:
Standalone version of Notes will not perform "After new mail arrive" agents as there is nothing that will generate mail arriving event

The scheduled agents will work.

The UI functions will not work in any backend agents (agents that are triggered by system events or by schedule). UI functions will work in the agents that are invoked by user.

You can use this piece of code for testing your scheduled agent

Sub Initialize
      
      Dim fileNum As Integer
      fileNum% = Freefile()
      Open "c:\myfile.txt" For Output As fileNum%
      
      Print #filenum%, "Hello World!"
      Close fileNum%
      
End Sub
0
Sjef BosmanGroupware ConsultantCommented:
From the Designer Help db:

An agent is a user procedure that you can trigger through a number of mechanisms. An agent runs on:
- The user's workstation if the agent's trigger is "Action menu selection," "Agent list selection," or "When documents are pasted."
- The server or workstation containing the agent if the agent's trigger is "Before new mail arrives," "After new mail has arrived," or "After documents are created or modified," or any of the "On schedule" options.

As it seems, the agent should be triggered. The problem my be the way you receive the mail. How is that exactly?

fgrushevsky is probably right in that you won't see the messagebox appear on the screen. If it a background agent, the output of a MessageBox will be written to the log.nsf database. On a server, that is, but I'm not sure it will be written in the log.nsf on your system. Try to open that database, it's called Notes Log, filename is log.nsf, and look in the Miscellaneous section. Open the documents there to see if your output is there.
0
chafford100Author Commented:
I have an account set up on my server in Malaysia which I use standard smtp and pop3. So I go to outlook and send an email. Then I switch to Notes and go to the replication tab and press send and recieve all. The email arrives and I get a return receipt back.

Now I have had a breakthrough, here is the log file:
02/02/2008 00:10:41   WARNING:  You are using a temporary license.  You have 59 days left in the trial license period.
02/02/2008 00:10:44   Lotus Notes client started
02/02/2008 00:10:44   Client Execution Security is enabled.
02/02/2008 00:11:10   Agent Manager started
02/02/2008 00:11:11   Dynamic Client Configuration started
02/02/2008 00:11:11   Initializing Dynamic Client Configuration
02/02/2008 00:11:11   Dynamic Client Configuration shutdown
02/02/2008 00:13:00   AMgr: Agent ('TESTAG1' in 'mail\trialuser.nsf') message box: New Mail Arrived
02/02/2008 00:13:14   Client shutdown complete
02/02/2008 00:13:14   Agent Manager shutdown complete

therefore you were right, the message box gets output to the log file.

Okay so the agent is running. The After mail arrives agent is working.

Do you have a code snippet which I can use to email myself back with confirmation so I can check the agent is working every time?

0
chafford100Author Commented:
Thanks fgrushevsky the code snippet worked.

One final thing before I close. Do you have a code snippet which I can use to email myself back with confirmation so I can check the agent is working every time?

The reason why I ask this is that I can read the document structure and get all the other email information I need out.
0
Sjef BosmanGroupware ConsultantCommented:
In your agent, while you're at it:

      Dim ns As New NotesSession
      Dim mdoc As NotesDocument
      Dim db As NotesDatabase

      Set db= ns.CurrentDatabase
      Set mdoc= New NotesDocument(db)
      mdoc.Form= "Memo"
      mdoc.SendTo= "chafford100  at   xxx;abc"
      mdoc.Subject= "Background agent report"
      mdoc.Body= "Agent rat at " & Now
      mdoc.Send(False)

Not necessarily error-free code...
0
fgrushevskyCommented:
The UI methods won't work in the backend agents. Instead, you can use "print"  and  output will be written to the log.nsf database. If you try to use messagebox or similar methods the agent will get run-time error.

Since your installation is stand-alone, sending mail could be problem. I suggest you setup SMTP account with your Notes client (open names.nsf , New-Account-SMTP), this way your client will be able to send mail. Otherwise mail will be just sitting within client internal mailbox

The code for sending mail would be something like this:

Sub Initialize
      Dim Session As New NotesSession
      Dim DB As NotesDatabase
      Dim Doc As NotesDocument
      Dim bodyitem As NotesRichTextItem
      
      Set db = Session.CurrentDatabase
      Set Doc = db.CreateDocument
      
      Doc.Form = "Memo"
      Doc.Sendto = "myemail@mydomain.com"
      Doc.Subject = "Background agent report at " & Format$(Now, "m/d/yy h:mm::ss a/p")
      
' This part is optional      
      Set BodyItem =  New NotesRichTextItem( Doc, "Body" )
      Call BodyItem.AppendText ("This is message body")
      Call BodyItem.AddNewline(1)
      Call BodyItem.AppendText ("Anything can go there")
' Only if you want detailed message
      
      Call Doc.Send (False)
      
End Sub
0
Sjef BosmanGroupware ConsultantCommented:
> The UI methods won't work in the backend agents.
True.

> Instead, you can use "print"  and  output will be written to the log.nsf database.
Not always true: Print in a web-agent will print to the HTML-stream.

> If you try to use messagebox or similar methods the agent will get run-time error.
Not true. Messagebox is not a method, it is a statement (or function) of LotusScript. A call to MessageBox in a background-agent will be logged in log.nsf.

Sending mail might indeed be a problem. I have no idea if the Notes client will send out the mail immediately, or that routing is delayed until the user explicitly activates the sending process, or when he closes Notes.
0
chafford100Author Commented:
Thanks for the info. I thought that the agent actually has a list of unprocessed documents which can be used or in your experience does the event fire once. the reason why I ask is that I need to process all the incoming email and ultimately decide whether to log it.

Therefore the code snippet should actually read the new email so for example I get an email like abc@def just sent you a mail in the subject.

MessageBox logged in log.nsf correctly which showed me the agent was working,

I read your comments on the delivery of email. While I am using standalone the client I am doing the work for uses R5 with Domino so I am expecting a smooth delivery of email.
0
Sjef BosmanGroupware ConsultantCommented:
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
chafford100Author Commented:
Thanks very much for all your help and patience. Much appreciated. I am making great progress.
0
Sjef BosmanGroupware ConsultantCommented:
Good! :-))
0
CRISILCommented:
hello,
I have similar query, the scenario one is :- I am using Lotus R6.5. On my mail file I have to run a triggered agent which should run after new mail has arrived. In Agent's security tab, runtime security level is set to 3 i.e. Allow restricted operations with full administration rights. and I have Manager accesss to my mail file, but agent is not running.
Whereas the second scenario is :- I have scheduled an agent on my mail file which will run on domino server and this agent connects to oracle and does some processing on mails. Same security options are selected, but agent is not running.
Can anyone help in this issue?
Thanks in advance.

0
Sjef BosmanGroupware ConsultantCommented:
Piggybacking questions is not the way to get your question answered. Only the people who are in this question will receive an alert by mail. You leave all the other experts out. They all want to help.

Open a new question, with a pointer to this one. I already have a question for you to look up: what messages do you find a) in the agent log, and b) in log.nsf? Please put that info in the new question as well.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.