Agent for checking dates and send email

I have a database with an agent that runs and checks dates, and sends an email if the today is greater than a date on the form. I copied the agent to another database and modified the code to compare a calculated date to today’s date and send an email if the calculated date is less than today’s date. The agent work correctly in the first database, but does not work on the second. Can agents evaluate a calculated date field? I don’t have any Domino training, so I tried to borrow the code from the working database. Any ideas are appreciated. Thanks

Subject: agent for checking dates and send email

Calculated fields only update when told to do so. It isn’t an automatic thing that happens in the background continuously. You can tell the fields to update by duplicating the field formula in code and overwriting the field values (e.g. doc.ReplaceItemValue(“datefield”, CDat(Today))) or by recalculating the entire document (e.g. doc.ComputeWithForm(True, True)).

Personally I use the first method, that is, duplicating any calculated field formulas in my code. I have had inconsistent results with ComputeWithForm.

HTH,

Charles

Subject: There are many reasons agents dont work

Test your code by running it manually

You can even use teh LS debugger in this case to check it out

THEN arrange for it to be trigger as you want.

add some debug Print statetment and check in the log

If its running on teh server

You may even find something as basic as the server not running them

e.g. The agent has to be ‘signed’ by someone with special rights

which you may not have

BTW: theres an FAQ on this forum for debugging agents

Look to teh right in “Resources” list