Bi-Weekly Agent

How does one schedule an agent to run every two weeks?

Subject: Bi-Weekly Agent

Ideally you need some sort of configuration document, where you can list the days of the week the agent is supposed to run - you can then set the agent to run daily, but in your code you can check the config doc day values and shut down the agent if the day is not correct.

Subject: A third option…

You could write three agents: A hidden agent that does the work, and two monthly agents that call the hidden agent.

Subject: Bi-Weekly Agent

If you use LEI you can run your agent through a Scripted Activity document and schedule the activity to run every two weeks.

Failing that, use a profile document to store the last date the agent did its real work, and do the real work again if the current date is that date + 14 days. Schedule the agent to run every day; 13 out of 14 times it will exit, doing nothing.

Subject: Bi-Weekly Agent

With difficulty.

What you’ll need to do is to set your agent to run weekly and wrap the functional part of the code in something which will determine whether or not it it should do something that particular week. For example, you could refer to a field in a profile document. If the field is “1”, then the agent should carry on with whatever it does and change the value of the field to “0”. If the field is “0”, it shouldn’t do whatever it does, but it will change the field to “1” so the code will run the next time.

You could easily schedule agents in a far more sophisticated way in R5. I don’t know why they took that away in R6.