Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating an agent to recognize a memo dropped into a folder

Status
Not open for further replies.

OutlookLust

Technical User
Aug 15, 2006
11
US
OK, I'm pretty new to Notes -- have for years been a die-hard Outlook/Exchange user. But I now see many of the superiorities of Lotus' solution over Microsoft's (as well as the inferiority of Lotus in the realm of interface friendliness).

So, I'm tinkering around with creating basic agents. I have a group email box that is to be used by a team of Customer Service reps that I manage. My idea is that when a Customer sends a message to that address, an agent will notify the team that there's a new message in the box so someone will check it.

THAT MUCH WAS SIMPLE AND I HAVE ALREADY IMPLEMENTED IT.

The next step is that the person checking the mail would determine if it's for a specific CSR. If so, they would drop it into a folder that belongs to that CSR. Here's the part I can't figure out:

I want another agent to notify the individual CSR that there is a new message in his/her folder.

What I can't find is a way to create a folder-level agent that will notify when a new document/memo/whatever is added.

Is this possible? Can someone tell me how?

Or is there a better way to do what I want to do? I'm wide open for suggestions and critique.

Thanks!

jb
 
Why has no one commented on either of the two posts I created? I am new here, but it seems to be a fairly active list. Anyone out there?
 
Ahh, August. Holidays. Time stretching out lazily.

Uh, right. Work.

So now, what's the issue ? Checking if a doc is in a folder and notifying someone ? Easy. Oh wait - need to check if doc is NEW in folder. Ahaa. Not so easy.

Let's see. Notes does not record the time stamp at which the doc was put in the folder. Putting a doc in a folder does not modify the doc either, so there is no way to actually compare the document's status compare to, for example, the day before.

That means that it is necessary to create that record to be able to compare it. I suggest that you create a hidden view. In the view, you'll need two columns : one for the folder name, one for the document UNID.

Create a Script agent that goes through each of your folders - I suppose you don't have all that many ? If I may be so bold, I would suggest that you develop all the functionality in a sub, and use the Initialize section to simply call the sub with the folder name as parameter.

The sub should open the folder and iterate through all documents therein. For each document, the agent should check the hidden view to ensure that it is present. If not already recorded, the agent should record a new doc in the hidden view, and then send a notification to the person responsible.

It would be a good idea to have the names of the people to be notified recorded in a document - maybe a Profile document (advantage : doesn't show up in views, disadvantage : you have to manage it carefully). That way, when sending a notification, the agent could look up the name of the person to send to, whereas changing the name of the person would not require code editing, but a simple document edit.

While we're at it, you could also put the folder names in said profile doc. That way you can add new folders and new notification recipients simply by editing the profile document. But let's take things a step at a time.

I'm sure I have thoroughly confused you now. Think about it all and, if you agree with me, we'll get down to the nitty-gritty of coding this beast.

Pascal.
 
Pascal:

Thank you for such a well thought reply. I like your idea of how to handle this. It has the advantage of scalability, of remaining useful if the team of CSRs grows larger. You did a good job of seeing the inherent problems we could encounter.

Currently, there are 7 CSRs that might be the ultimate recipients of an email in that box. So, there will be 7 folders to work with.

--------------
Question: Another possibility that would do equally as well for our purpose would be for a script to look at each folder to see if there is any unread mail in it. If there is, forward that message to the owner of that folder and then mark the message as "read" (but not delete it). Even better that forwarding the message (if this were possible) would be for the script to actually copy the message to the user's own inbox, but I don't know if that is possible. Would either of these be any simpler? They would actually save the CSR from the trouble of going to the shared email account to check messages and then transfer the message to their own account.

OH CRAP! -- I just tried dragging a message from the group email account into my personal inbox and am unable to do this. I could swear that when I started tinkering with this I could do that. Have I broken something? The problem is that the group email account is configured for receipt only, not reply. I want the individual CSRs to reply to the messages from their own email addresses.
--------------

Anyway, if my idea is more complicated to implement or is not doable or has holes, I'm ready to begin coding your idea (with your guidance).

Thanks so much!

jb
 
Is it such a problem to have people manage their documents in another mail box ? I mean, you talk about copying a mail to their own mailbox - sure it can be done, but is there really a point ?

Let's imagine this : the shared mailbox gets a new doc, and a notification (with a doclink) is sent to the relevant CSR. This person opens the mail and clicks the doclink, thus opening the document in the shared mailbox. At that point, he can click a button on the mail and "take possession" of the document, hiding it from the other CSRs. He can then continue to manage the document from there, instead of polluting his personal mailbox with what constitutes a workflow application document.

The concept of hiding the document can be as strict or as loose as you please :
- put the CSR's name in a Readers field and he'll be the only person to read it (attention : NOBODY else will see the document, not even the Domino admin, even if the CSR is on holiday !)
- put a role name that the CSR belongs to, and only those with the same role will be able to see the document (meaning the CSR and a supervisor, useful for the holiday issues - also, someone can be assigned a role temporarily)
- just move the document to a folder, meaning anyone can read it if necessary, but generally CSRs will only work in "their" folder

The idea behind this is that you already have a workflow application here, so it is better to keep the work done in one place. That way, you create a history of intervention on every document, history that is quantifiable and consultable when necessary. If docs go to personal mail files, then you lose a great deal of leeway concerning what you can follow on what has been done.

Would this approach be feasible for you ?

Pascal.
 
Pascal:

I wrote a reply to your post several days ago and before submitting it I crashed hard. I forgot about that, so until now I thought I was waiting on your reply. Sorry.

I do like the option of having all of the mail activity stored in the group box (Inbox, folders, Sent Items). At the same time, it is important to me to have the replies come from individuals rather than from a group, and to have replies back from the customer to go to the individual's personal address.

I could imagine a method of doing this if the group mailbox somehow recognizes who is replying to the message, changes the "friendly name" (whatever Lotus calls that) in the From field of the outgoing message, and changes the "Reply To" in the outgoing message.

If that is possible, I'm definitely all for it. Can Lotus do all of that?

Regarding the holiday issue, I prefer the 3rd option you listed ...

- just move the document to a folder, meaning anyone can read it if necessary, but generally CSRs will only work in "their" folder

Part of the reason for having the group box is so that other people can cover CSRs when they are not available.

How should we proceed?

Thanks so much,

jb
 
Well if you want the replies back to go to individuals, then you lose track of it in the CSR folders, don't you ? But I don't know the hows and whys, and anyway, want you do want makes things easier.

Indeed, all you actually need to do is redirect the Reply and New Memo buttons in that mail database to the user's mail. So, when a CSR creates a reply to something, he is actually creating it in his mailbox, and it should thus go out under his name.

By doing that, we get the "individual" touch, and replies come back to that individual. Of course, the main db is then out of the loop, and when the main CSR comes back, there will be some explaining and showing mail folders to get everything back on track.

Is this what you want ?

Pascal.
 
Well, you've got me questioning what I want -- you're helping me think through it better. At the core of what I really want are the following:
(1) To have a group record of email traffic
(2) To alert the CSR when a new message for him/her arrives in his/her folder
(3) To keep a personal touch -- replies to and from a named person, not a group or generic name.

Within those paramenters, I'm wide open. I'm sure my imagination has been limited by projecting Outlook's capabilities (and lack thereof) onto Lotus, not yet being fully aware of what Lotus can do.

jb
 
A common issue :).

Lets go through your requirements :

1) A group record of email traffic
You have a mail db that gets all email from outside. We can continue using that and make it comply with the rest of the parameters.

2) Alert CSRs when new mail arrives
If you're ready to wait 5 minutes at most (the minimum trigger time for scheduled agents), then you've got it - a New Mail agent that sends a link to the doc that has just arrived. All you need is to detect which CSR (or which backup CSR) needs to recieve the notification.

3) The personal touch
A tad more difficult to arrange. If we use the user's mail to reply, then we'll be losing mails from the central db. If we don't want that, then we're basically going to have to spoof the sender. Fortunately, we can do that without breaking the rules, because there is a From field, but there is also a ReplyTo field and they do not necessarily have to be the same.
Therefor, by modifying the Memo form in the central db to add a ReplyTo field, and check that the From field does indicate the name of the current user, you should be able to get that personal touch without losing the "centralness" of the application.

Of course, if we manage to get this working, it means that the New Mail agent is going to have to detect whether incoming mail is a new mail or a reply to an existing thread. The difference is that new mails need to be dispatched to the head CSR, while replies need to be notified to the recipient (not necessarily the same) - unless you wish for the CSR to remain the central contact.

Pascal.
 
You've got it. And #3 seems the trickiest to me, too. Because there could potentially be a relatively high volume of messages in a conversation thread, I don't want the Triager CSR to be responsible for moving every message in each conversation to the correct folder. Is the FROM information from the previous message stored in a reply? That is, if a CSR replies to a message and Lotus uses the CSR's own name and address in FROM but alters the REPLY TO, when the customer writes back is there any record in the message header of that original FROM? If so, an agent could use that to decide where to file the message. [That was difficult to put into words, hopefully it was clear enough].

So, what should happen in our modified scenario is:
(1) A new message on a new conversation arrives in the
group mailbox
(2) Within 5 minutes, an agent notifies the Triage CSR that
a new message has arrived.
- Note: Because of vacations, maybe we should think of
an easy way of choosing an alternate Triage CSR when
necessary
(3) The Triager determines who should respond to the email
and drops it into a folder bearing the Assignee's name
(4) Within 5 minutes, an agent notifies the Assignee that a
new message has arrived in the folder
(5) The Assignee replies to the message from that folder.
- The reply will be stored...where?...in the group's Sent
folder?
- The FROM field of the reply will reflect the Assignee's
name and email address.
- The REPLY TO field of the reply will reflect the group
email address.

Is that the way you understand it?

jb
 
Globally we agree. The problem with FROM and REPLY TO data retention is that we're dealing with a high potential of non-Notes mail clients, and I have no notion of how they manage the difference and what data they keep.

In any case, I believe that the process as you describe it is correct. For you question in Point 5, the reply is stored in the group mailbox - as to where, that depends on what the user does in the Save And File dialog box. Eventually, you can force the document to be saved, but in that case, if the user does not store the document in the correct folder, there will have to be yet another agent to write that will have to sort out which mails have not been stored and where they're supposed to go. I suggest you include in the db procedure an obligation to store replies in the proper folder. Mistakes will be made, but they will most probably be spied and corrected a lot quicker than the time it will take to get the process automated.

Pascal.
 
I think the first thing to look at is how to sort out who gets an alert. What is your criteria for that ?

The second thing to look at is the New Mail agent and LotusScript. You're going to need Script for this project, since Formula language cannot be used for the kind of complexity that we need.

Have you ever programmed in Visual Basic ? LotusScript is quite similar.

Anyway, we're going to need an agent to send out an alert to someone when a new mail arrives.

Ideally, the agent would detect which CSR is needed and send the alert to that person, putting the mail into the right folder at the same time. We'll deal later with the replies and other issues.

That sound good to you ?

Pascal.
 
Pascal:

Sounds good. Your help is very much appreciated!!

I'm not sure how an agent can determine who an original email in a conversation is intended for, which is why I planned for human intervention in order to get it into the right folder. A new message may also not be for a specific person, in which case it would be assigned to a CSR on a rotation schedule. If you can think of any magic to accomplish this, though, please feel free to suggest.

Am I a programmer? Not a programmer per se. But I consider myself relatively adept at troubleshooting code and "stealing" and modifying code (if I have a reference to consult). For instance, I couldn't do much in the way of writing a decent Web page using Notepad, but give me DreamWeaver, some templates for the shell, some javascript from Internet forums or other peoples' sites, and a little time and I'll figure out how to customize it to what I need.

I've worked with VB For Applications (such as creating some rather elaborate macros in Word) and did some early generation VB programming building applications out of Microsoft Access.

I say all that to say that a programmer I'm not, but I'm self-taught, code-aware, and can struggle and hack through most things with guidance.

OK, down to the details. Let's give some artificial names to the CSRs.
1. Julie
2. Karen
3. Bob
4. John
5. Cindy
6. Pam
7. Mary

So, Julie is normally going to be the Triager. When she's out, any one of the CSRs might fill in for her. The Triager is the one who will be notified that a new message gas arrived in the general group mailbox.

If a message arrives for Bob, an agent will notify Julie (or her sub). Julie (or her sub) will drop the message into a folder named "Bob." An agent will notify Bob that he has a new message.

Bob will open the group mailbox and reply to the customer. Bob's reply will say it is coming from bob@ourcomany.com. The reply will be stored in the group's Sent folder.

The customer will reply to Bob, and the reply will go to the Reply-To address (which is the group email address).

From that point we can work out the details later.
 
Okay, down to business.

Step 1 : create a Profile document for the Triager. To do so, create a Form named Profile_Triager. In it, you will need three fields : one to name the Principle Recipient, one to name the Substitute Recipient, and one to toggle between the two. Lets name the fields Principle, Substitute, and Toggle. The first two should be Names fields (set to get the choices from the server NAB), the Toggle should be Radio Button, with choices of "Principle|1" and "Substitute|2" (without the quotes in the code, obviously).

Once you have the form, you need to be able to access it. For that, an agent or a view agent is required, with code like this :
Code:
@command[[EditProfileDocument];"Profile_Triager")

This button you might want to restrict in visibility to those who have a certain role. On clicking this button, the proper Profile document will be created, and if you have coded it correctly, you should be able to easily input the proper names. Set the Toggle to the Principle for now, and save the document.

Step 2 : With the Triager profile created, we can now create a New Mail agent, that is a Script agent, scheduled for When New Mail Arrives. You need to simply get a handle on the new mail, open the Profile_Triager document and send a notification to the selected recipient. Easy, right ? Of course ;-).
Code:
dim session as new notessession
dim db as notesdatabase
dim coll as notesdocumentcollection
dim doc as notesdocument
dim olddoc as notesdocument
dim triagerdoc as notesdocument
dim maildoc as notesdocument
dim body as notesrichtextitem

set db = session.currentdatabase
set triagerdoc = db.getprofiledocument("Profile_Triager")'this is how we open the profile document
set coll = db.unprocesseddocuments'this is how we get the handle on the mail that has just arrived
set doc = coll.getfirstdocument
do while not(doc is nothing)
    set maildoc = db.createdocument
    maildoc.form = "Memo"
    if triagerdoc.toggle(0)="1" then
        maildoc.sendto = triagerdoc.principle(0)
    else
        maildoc.sendto = triagerdoc.substitute(0)
    end if
    maildoc.subject="New mail has arrived in the corporate mailbox"
    set body = new notesrichtextitem(maildoc,"body")
    call body.appenddoclink(doc,"Link to the mail item")
    call maildoc.send
    delete maildoc'we can discard this now to not clutter the memory
    set olddoc = doc
    set doc = coll.getnextdocument(olddoc)'iterating to the next new mail
    delete olddoc
loop'and we're done

That'll do for the second step. Implement this and we'll see how we proceed from there. Good luck !

Pascal.
 
Pascal:

Since the date you sent your last message I have been trying to figure out whether I actually have what I need in order to create a form in Lotus. I just now was able to discover that I need and don't have Lotus Designer installed. I will be getting it probably today (our local IT department is very small and things take a while).

Again, thanks for the help. I'll write more when I get Designer and create the form and agents.

jb
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top