There are several ways to run an agent in Lotus iNotes.
Results of an agent can be put into a NotesVar:
<NotesVar name=
varname value={@DbCommand("haiku";"h_RunAgent";"
name";"
loc")}>
name = the name of your agent
loc = location of agent (default = 0):
0 = user's mail file
1 = Forms file
2 = Extension Forms file (available starting in 8.5.2)
An agent can insert content directly into the HTML of a page. This agent writes out <option> tags:
<select>
@{@DbCommand("haiku";"h_RunAgent";"
name";"
loc")}
</select>
You can use an XHR request to execute an agent using a URL like this:
iNotes/Forms85.nsf/iNotes/Proxy/?EditDocument&Form=s_RunAgent&PresetFields=AgentName;
name
Note that agents run like this must be in the Forms file. Starting in 8.5.2, there is another preset field you can use:
PresetFields=AgentName;
name,CommonAgent;
loc
loc = location of agent. The values are the same as above. The default is 1.
Agent properties:
- Set the agent's target to: NONE.
- Enable the "Run as web user" checkbox on the second tab.
- Open your Domino Server document in the names.nsf database.
- On the Security tab, set the following field to include your canonical name: "Run unrestricted methods and operations. " By adding your name to the list, you allow any WebAgents created by you to run on this Domino server.
In the agent:
- MessageBox statements will write text to the server console
- Print statements will write text to be returned to the browser