Link to home
Start Free TrialLog in
Avatar of jkasavan
jkasavanFlag for United States of America

asked on

Enable and disable agent based on date in Lotus notes

Using Lotus Notes 6.5.2 on Windows XP. I need to use the Out of Office "OOO" agent once a week, but I can't seem to figure out how to enable it on Fridays and disable it on Mondays automatically. This pseudo code shows what I would like to do:

Check date and time
      When day of date is Friday and time is 2:00AM
             Enable OOO
      When day of date is Monday and time is 2:00AM
             Disable OOO
End

As an alternative, I could write a simple agent (Friday_away) that would run on Friday at 2:00AM and reply to all messages that I will be away until Monday. Again, I don't see a way to run another simple agent on Monday (Monday_back) at 2:00AM that will disable the Friday_away agent.

Thanks for your help.
Avatar of qwaletee
qwaletee

Problem is that four things occur to make OOO work:

1) Agent is enabled/disabled manually through the OOO profile
1a) When agent is enabled, it aborts if it is not yet the start date
1b) When agent is enabled, it only sends a reminder message to you if the end date is past

2) When the agent runs during the active range (1a and 1b did not iccur), it takes MATCHING messages and "rpelies" to them.  Matching messages are those that it has not responded to yet AND THAT FALL IN THE CORFRECT DATE RANGE

So, there are three ways to write your enable/disable code:
a) Replace (1)'s manual process with an automatgic process -- but that would not affect the dates used in 1b, 1c, or 2, sol you'd have to fix the dates in the OOO profile automatically
b) Automatically update the OOO profile -- but then the ganet would always be needlessly active (not such a big deal), and you would have to make sure that it can process based on 2:00 AM instead of midnight
c) Don't use teh native OOO. Instead, write a dumbed-down version that does a simple reply, but your Notes engineering team will have to give you the authority to deploy this alternative version to their server

I would go with #3, if your IT will allow it. The agent is fairly trivial, if you don't need anything fancey:


yourName := "J. Kasavan";
yourMessage := "I am out of the office Friday-Sunday, I'll get back to you when I'm in."
SELECT (@Weekday(DeliveredDate) = 1:7) | (@Weekday(DeliveredDate) = 6 & @Hour(DeliveredDate) > 2) | (@Weekday(DeliveredDate) = 2 & @Hour(DeliveredDate) < 2)
notify := @If(ReplyTo <> ""; replyTo; Principal <> ""; Principal; From = ""; @Return(IMPOSSIBLE); From);
@MailSend(Notify; ""; ""; yourName + " is out of the office ... Re: " + Subject"; yourMessage);

Open in new window

Avatar of jkasavan

ASKER

I am not sure where I type in those commands in the agent.
Create->Agent

A design panel and properties box will pop up. Give the agent a name, change the run parameters from "action menu" to "after new mail." Change the type of agnet from SIMPLE ACTIONS to FORMULA, then paste the agent code I gave you into the design pane.
Do I include the line numbers? The pasted code has the numbers separated from the rest of the code:

1:
2:
3:
4:
5:
 yourName := "J. Kasavan";
yourMessage := "I am out of the office Friday-Sunday, I'll get back to you when I'm in."
SELECT (@Weekday(DeliveredDate) = 1:7) | (@Weekday(DeliveredDate) = 6 & @Hour(DeliveredDate) > 2) | (@Weekday(DeliveredDate) = 2 & @Hour(DeliveredDate) < 2)
notify := @If(ReplyTo <> ""; replyTo; Principal <> ""; Principal; From = ""; @Return(IMPOSSIBLE); From);
@MailSend(Notify; ""; ""; yourName + " is out of the office ... Re: " + Subject"; yourMessage);
Take out the line numbers
Getting this cryptic (to me) error when trying to save:

@Function or operator expected, or @Function does not require an argument: ')'
My bad. Three typos. Two missing semi-colons, and one extra double-quote. Here's the corrected code:

yourName := "J. Kasavan";
yourMessage := "I am out of the office Friday-Sunday, I'll get back to you when I'm in.";
SELECT (@Weekday(DeliveredDate) = 1:7) | (@Weekday(DeliveredDate) = 6 & @Hour(DeliveredDate) > 2) | (@Weekday(DeliveredDate) = 2 & @Hour(DeliveredDate) < 2);
notify := @If(ReplyTo <> ""; replyTo; Principal <> ""; Principal; From = ""; @Return(IMPOSSIBLE); From);
@MailSend(Notify; ""; ""; yourName + " is out of the office ... Re: " + Subject; yourMessage);
Is there a "debug" process for this? Today (Friday) I sent myself some test emails and no reply back from Notes. Then I enabled he OOO tool and I did get an OOO message from that.

Do I still have to request Notes Admin to allow this agent to execute on the server? What exactly would I need to ask them?
ASKER CERTIFIED SOLUTION
Avatar of qwaletee
qwaletee

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Yay - it's working. Solution accepted.
Thanks much for your help.