Examples: LastRun property (Agent - Java™)
For each agent in the current database, this agent prints its name and the last time it ran.
import lotus.domino.*;
import java.util.Vector;
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext =
session.getAgentContext();
// (Your code goes here)
Database db = agentContext.getCurrentDatabase();
Vector agents = db.getAgents();
for (int i=0; i<agents.size(); i++)
{
Agent agent = (Agent)agents.elementAt(i);
DateTime date = agent.getLastRun();
if (date.getDateOnly() != null)
System.out.println("Agent " + agent.getName() +
" last ran on " + date.getDateOnly() +
" at " + date.getTimeOnly());
else
System.out.println("Agent " + agent.getName() +
" hasn't run yet");
}
} catch(Exception e) {
e.printStackTrace();
}
}
}