Question about mailagent

Hello,

Im having trouble creating a mailagent.

I created a database for logging contracts with a bunch of info, for example who is responsible for which contract, how long is it valid, what are the costs etc etc.

Now i want to create a mailagent that does the following:

It should send an email 14 days before the contract should be reconsidered to the person who is administrating the contract and to the person who is responsible for it.

I have the following fields:

ContractResponsibleField (you can select names from the notes adresbook here)

ContractAdministratorField (same as the previous field)

ContractDurationField (you can choose between 1 year, 2 year etc, up to 5 years)

ContractEndField (a computed date/time field which sets this field to the startdate + ContractDurationField)

ContractCancelField (period of notice field, ranging from one month before the conract ends to 6 months before the end of it)

So my bet would be I need an agent who does the following:

when the enddate of the contract minus the period of notice is 14 days from today it should send an email with a doclink to the specific contract so that the admin or the responsible can take action.

Further more I would like to be able to send them the same mail 1 week before it ends and maybe the final day a reminder or something.

When they take action the first time they receive the mail, both other mails are obsolete and should not be send anymore.

Problem is I have no idea how to fit this into an agent.

Can someonde help me please?

ps: I tried to phrase my question as clear as possible, but if someone doesnt understand it, don’t hesitate to ask :slight_smile:

Thanks in advance,

Sander Voss

The Netherlands

Subject: Question about mailagent

Hello,

Best would be to have 2 time based views which compute daily for getting the documents say 14 days prior to Contract day expiry and a week , as u require. Take Contract end dat as the date and u can write a code in the view selection formula to get the documents in it.

Now, u can have scheduled agent , which run daily on that view , probably after office hours and send out the mail to the Contract Administrator.

Hope this helps

Tom

Subject: RE: Question about mailagent

I was still trying to work this out and came up with the following (with help from a collegue)

In the ContractForm I created an extra field which calculates the dates:

@If (ContractEndField = “” | ContractCancelField = “” ;

“” ;

@Adjust (ContractEndField ; 0 ; - ContractCancelField ; -14 ; 0 ; 0 ; 0))

So when both the enddate and the cancelfield are empty, it does nothing. If they are both filled in, it sets this field to enddate minus xx months, minus 14 days, where xx is the number of months to count back from the enddate.

This field (CalculateField) is working the way I want it and I want to use that field in my agent:

@If (CalculateField = @Today & ContractYesNoField!=“No”;

@MailSend ( ContractAdministratorField ; ContractResponsibleField ; “” ; “testmail 14 days before Contract should be reconsidered” ; “” ; “Click on doclink”; [IncludeDoclink] ) ;“”);

Select @All

So the agent should send an email inlcuding a doclink to both the contract admin and the contract responsible when the Calculatefield is today and the field which specifies if the contract is still valid or not is not set to “No”

Looks quit logical to me, but it aint working.

Does someone have any idea what is going wrong here?

Thanks in advance :slight_smile: