Can I run an agent 3 business days before month-end?

Hello,

I have a labor entry database in Notes and I need to send out a message by Lotusscript agent to supervisors who have not approved their employees timesheets so that they can approve them by month-end. I need this email to go out 3 business days before the end of the month - for example, in October, I need this email to go out on Friday, October 27.

I can do this by using an admin document where I have the day defined for each month, but I’m trying to do this without the admin document. I have looked at using @BusinessDays, but I have not been able to come up with anything like this. Does anybody have any ideas on how I could achieve this without using a predefined send date?

Thanks,

Neil

Subject: Can I run an agent 3 business days before month-end?

I would write a LotusScript agent scheduled daily that works out whether today is 3 days prior to month end and,if so, calls your other agent

Subject: RE: Can I run an agent 3 business days before month-end?

Neil,

Gets current date and checks if date is after 24th of every month. If so executes other statements. Otherwise quits.

Gets the current month’s last day (10/31/2006) into the variable ‘curmth_lstdy’

In forloop, calculates business days between the dates in loop to the ‘curmth_lstdy’. If ‘tmp’ equals 3, then you can do the action you want at this point as follows, by replacing the existing ‘prompt’ statement there:

curdt := @Today;

@If(@Day(curdt) >= 24; “”; @Return(“”));

daydiff := 0 - @Day(curdt);

nxtmthdt := @Adjust(curdt; 0;1;0;0;0;0);

curmth_lstdy := @Adjust(nxtmthdt; 0;0;daydiff;0;0;0);

@For(n:=1; n < 6; n:=n+1;

stdt := @Date(@Adjust(curmth_lstdy; 0;0; 0-n ;0;0;0));

tmp := @BusinessDays(stdt; @Date(curmth_lstdy); 1:7);

@If(tmp =3;@Do(@Prompt([Ok];“T”; @Text(stdt)); @Return(“”));“”))

This way you can run the agent to do the action on the last 3rd business day of every month. If you want to run the agent on all the last three business days, change the condition according in the forloop for the ‘if’ condition as :

@If(tmp <=3; @Do(all your action statements); @Return(“”))

If this is the case check for Weekday using @Weekday(stdt), if falls on a weekend, do not run the agent. Other possibility though…

Subject: RE: Can I run an agent 3 business days before month-end?

Thanks Narasimhan. I’ll give your solution a try.

Neil