Solved

What's running after my "Before new mail arrives" agent?

Posted on 2010-09-09
11
1,419 Views
Last Modified: 2013-12-18
I'm trying to write an agent in LotusScript that removes the field "Form" from incoming messages that meet a certain criteria. I've gotten the code to work, based on results in the agent log, but the problem is this: after the code runs on the incoming messages, the value of field "Form" is reset to <trouble value>. These messages are generated by our voicemail system and contain attached .wav files; I need to clear the Form field so that, instead of trying to use the embedded java player, you can just play the .wav file through whatever media player is set in the OS. There's a ton of code on the form.

Is there, somewhere, a concise list of what events are triggered when a new message arrives? Is it plausible that something in the messages' contents is resetting this field after the "Before new mail arrives" agent runs? I'd prefer not to make this an "after new mail arrives" agent to avoid the delay that that entails.

Any help is greatly appreciated.

~ben
0
Comment
Question by:ben_wall
  • 5
  • 3
  • 3
11 Comments
 
LVL 22

Expert Comment

by:mbonaci
Comment Utility
Hmm, I have to admit that I don't understand why wouldn't you use "after new mail arrives"?
The delay, you're talking about, will be determined only by your code and you must put the code somewhere, so why not put it in the event that's invented exactly for situations like yours.

Why exactly are you removing the form field?
0
 
LVL 22

Expert Comment

by:mbonaci
Comment Utility
OK, I see why.
Look (in Designer) at form properties, Launch tab. There you'll find settings about which player is used.

The workaround (if you're not allowed to make changes to the form) would be to copy the form, name it differently, and change launch properties.
Then, in your agent, instead of removing Form field, simply change the value (to your new form's name).
0
 
LVL 46

Expert Comment

by:Sjef Bosman
Comment Utility
Removing the Form-field in a pre-arrival agent seems like a bad idea to me. Notes doesn't really required that field, but much depends on it actually. You could set it to a different value though, e.g. "MemoX" or so.

There are only pre-arrival and post-arrival agents, nothing else gets triggered when a mail comes in. And you're right, the pre-arrival agent runs immediately, on the arriving mail itself, whereas the post-arrival agent runs like any other agent (which allows you to use UnprocessedDocuments).

What I don't understand is your story about the embedded player. Does Notes have an embedded player to run WAV files? And if so, what does that have to do with the Form field? Or is there some function placed on the Memo-form that you want to circumvent? Did you modify the Memo form of the standard mail template?

Maybe there are more and better ways to accomplish what you want, besides just changing the Form field... I'd need more information to be able to find that out.
0
 
LVL 46

Expert Comment

by:Sjef Bosman
Comment Utility
Ah, Marko, also "assuming" ? There is really a delay, it can be many minutes depending on the server's current load. Yes, there is probably a parameter to bring that delay down, but the agent will never run immediately.

I didn't know about the form properties' launch tab settings, I have to admit I never really understood what it's for :-P Does that also override the right-mouse click?
0
 
LVL 22

Expert Comment

by:mbonaci
Comment Utility
How do you mean "Does it override right-mouse click", it reacts with specified (in form properties) action on form's QueryOpen or PostOpen event.
Like launching the first attachment (or embedded OLE), playing specified vaw file,...
I also never used this, but I have tried it once upon a time :)

http://publib.boulder.ibm.com/infocenter/domhelp/v8r0/index.jsp?topic=/com.ibm.designer.domino.main.doc/H_ABOUT_FORMS_THAT_LAUNCH_OBJECTS_AUTOMATICALLY.html

ben_wall,
is there any code in the form's QueryOpen or PostOpen events? It could be possible that the launch is coded there, instead of using form launch properties.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:ben_wall
Comment Utility
Thanks for the comments, so it seems I need to provide more info.

This is the Domino Unified Communication template, StdR85UCMail, and the form is fa_RcvdVoiceMail. This adds an embedded .wav player, and a bunch of automation, for voice mail messages. Unfortunately, there is no version of this template for the Mac version of Notes, and no version for the iNotes web interface on any browser except Internet Explorer (and as an organization, we recommend FireFox.) We found that if we programmatically remove the Form field, then you get a plain message with a .wav attachment that, when launched, uses the OS media player; otherwise, it doesn't work at all in iNotes on FireFox/Chrome/Safari, and you get multiple error messages in Notes for the Mac.

The problem with the after mail is received agent is that it takes too long to work; the delay is unacceptable for this purpose. Thus, the before mail arrives agent... but it doesn't seem to work as expected, or, rather, it seems to run (based on what's showing up in the agent log,) but the Form field is not changed. If I run a version of the code modified for the Action menu, it works fine. I've attached my code, if that helps. You can see I've gone through a couple of iterations of removing or changing the Form field.

So, I'm open to suggestions. The goal is to have a plain text email with a .wav attachment that can be played normally on any platform.

Thanks very much for your help.
Sub Initialize()

Dim s As New NotesSession

Dim d As NotesDatabase

Dim doc As NotesDocument

Dim fld As NotesItem

Dim chk As NotesItem

Dim dbug As NotesLog



Set dbug=New NotesLog("Router Log")

dbug.Logactions=True

Call dbug.Openagentlog()

dbug.Logaction("Preprocessing agent begin--->>")



Set d = s.currentdatabase

'Set col=d.unprocesseddocuments

'Set doc=col.getfirstdocument()

Set doc=s.Documentcontext

Set chk=doc.Getfirstitem("Subject")

dbug.Logaction("doc subject is: " & chk.text)

If InStr(chk.text,"Voice Mail Message") Then

	'Set fld=doc.Getfirstitem("Form")

	Call doc.Replaceitemvalue("Form", "Memo")

	'Call doc.Removeitem("Form")

	'Call doc.Replaceitemvalue("Form", "")

	Call doc.Save(True, False, False)

	

	Set fld=doc.getfirstitem("form")

	If InStr(fld.text,"Memo") Then

		dbug.logaction("form apparently changed")

	End If

End If





dbug.Logaction("<<---Preprocessing agent done")

Call dbug.Close

End Sub

Open in new window

0
 
LVL 22

Accepted Solution

by:
mbonaci earned 500 total points
Comment Utility
Aha, I see, your problem is that it (sometimes) takes too long for "after mail arrives" agent to respond, right?

There is a setting in Notes.ini with which you can control how often Agent manager checks for un-triggered messages.

It is called AMgr_UntriggeredMailInterval

This setting specifies a delay (in minutes) between running of the Agent Manager's check for untriggered mail. Valid values are 1 minute to 1440 minutes (the number of minutes in a day). The default value is 60 minutes.

See here, in the comment I posted, for all other mail agent related params in Notes.ini:
http://www.experts-exchange.com/Q_25137729.html#26839764
0
 

Author Comment

by:ben_wall
Comment Utility
That's a great idea. I checked our server docs and found that they are all set to the default of only 1 concurrent agent. After checking with the other Notes admin here, we're going to try upping that to 10 to see if that makes a difference, and then we'll try the AMgr_UntriggeredMailInterval. Although it's set to default, we see "after mail arrives" agents running in just a few minutes - which is still too slow for the voicemail messages.
I'll let you know how it turns out, although this may take a couple of days.
0
 
LVL 22

Expert Comment

by:mbonaci
Comment Utility
0
 
LVL 46

Expert Comment

by:Sjef Bosman
Comment Utility
@Marko, did you read my previous post? ;-)

Two remarks on the code:
- you're not supposed to save the document inside a pre-arrival agent, the document is yet to be saved by the server
- you could indeed change the contents of the Form field into the name of a different form, one that you prepare without the voicemail activation option
0
 

Author Closing Comment

by:ben_wall
Comment Utility
Your linked article provided the solution - Controlling how many concurrent agents are running. After increasing the number of concurrent agents from 1 to 10 on all incoming servers, the "After mail arrives" agent is almost instantaneous.

Thanks very much.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

772 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now