getAgent (NotesDatabase - JavaScript)

Finds an agent in a database, given the agent name.

Defined in

NotesDatabase

Syntax

getAgent(name:string) : NotesAgent
Parameter Description
name The name of the agent.
Return value Description
NotesAgent The agent whose name matches the parameter.

Usage

The return value is null if the current user (as obtained by Session.getUserName) is not the owner of a private agent.

Examples

This button gets information on an agent.
var name:string = requestScope.query;
var agent:NotesAgent = database.getAgent(name);
if (agent == null) {
	requestScope.status = "No such agent";
} else {
	requestScope.status = agent.getName();
	requestScope.status += "\n" + agent.getOwner();
	var date = agent.getLastRun();
	if (date == null) {
		requestScope.status += "\nNever run";
	}	else {
		requestScope.status += "\n" + date.getLocalTime();
	}
}