How do I have to customize an agent in iNotes 8.5.1?
What did I do until now?
I copied the Forms85.nsf to MyForms85.nsf for own agents and so on. In my used mailbox I changed the FormsTemplateFile entry in the icon resource to ‘MyForms85.nsf’.
I created a Forms85_x.nsf and customized the subform Custom_JS_Lite to get my own additional menu items.
I already created a simple agent (MyAgent), only to put an info text to the server console. This agent is saved in MyForms85.nsf.
In the function Custom_Scene_PostLoad_Lite (in Forms85_x.nsf) I called the agent with a command string like this
var sAgentName = “MyAgent”;
var sCmd = ‘iNotes/MyForms85.nsf/iNotes/Proxy/?EditDocument&Form=s_RunAgent&PresetFields=AgentName;’ + sAgentName;
My problem is that this simple agent is never executed although this command should be called and there is no error message.
That URL to run the agent should work. Check to make sure you have rights to run an agent in the Forms85 file. Also check the checkbox on the 2nd tab of the agent properties dialog is set to “Run as Web User”.
In the agent:
MessageBox statements will write text to the server console
Print statements will write text to be returned to the browser
Are you sure your Custom_Scene_PostLoad_Lite code is being called? You may want to put an “alert” statement there just to be sure. If the form being used is the mail edit form, then your code should be in Custom_JS, not Custom_JS_Lite. For mail read, the right subform is Custom_JS_Lite.
I solved this problem meanwhile and the agents work fine. But now I created a Formula agent, my only statement is a @Prompt statement. It doesn’t work. Is there a different to agents in LotusScript?
The @Prompt function does not work with web applications. I’m not sure if there is a formula language function that writes to the server console. If you just want to test the agent, I suggest you use LotusScript and the MessageBox function.