I am trying to assign a value to multiple documents at once through a custom menu option located in the Inbox. I am able to gather the necessary information, pass the selected document ID’s, and call the agent to perform the action. However, when the agent is completed, I end up with a new, blank tab in my browser. Looking at the HTML, it is basically a blank page. Domino 8.5, 32 bit, Windows, and Firefox 3 on the client side.
Subject: Need more detail
Can you give a little bit more detail? What is the code you are using to call the agent? I assume that code is an action that you added in the Custom_Scene_Actions_Lite function in Custom_JS_Lite?
Subject: More detail
I started with this article: IBM Developer
and this example to call an agent
function CreateRunAgentHTML() {
if (document.forms["agentcmd"]){ return; }
var aUnids = API_GetSelectedDocs();
if (!aUnids){ alert("Unable to get the UNID of for the Document Context!"); return; }
var sAgentName = "ReadMailRtAgent";
var sCmd = API_GetMailfilePath() + '/0/' + aUnids.join(';') + '?EditDocument&Form=s_RunAgent&PresetFields=AgentName;' + sAgentName;
var s = '<iframe name="myAgentFrame" id="myAgentFrame" class="s-hidden-iframe" src="about:blank"></iframe>'
+ '<form name="agentcmd" target="myAgentFrame" method="post" action="' + sCmd + '">'
+ '<input name="StartDate" type="hidden">'
+ '<input name="Period" type="hidden">'
+ '<input name="Approver" type="hidden">'
+ '<input name="Justification" type="hidden">'
+ '</form>';
// (DWA extends the Element class for Gecko to support this method)
document.body.insertAdjacentHTML("beforeEnd", s);
}
I copied the form s_RunAgent and changed the value of commonagent to “0” so that it runs in the mail file, rather than forms85.nsf.
In Custom_JS_Lite, I have added a menu option to call a function RemoveHoldTag_Lite that is also in this subform. I fill in the values of the hidden form, and then submit it via document.forms[“agentcmd”].submit()
I make the same call from Custom_JS, with slight modifications for the different mode.
Subject: Some more information
If you are adding your new action item to the Inbox view, then you are working with the newer “lite” architecture in iNotes. The article you cited uses the older “classic” code architecture. Here’s an updated article on manipulating data in the new “lite” code architecture:
http://www-10.lotus.com/ldd/dominowiki.nsf/dx/manipulating-data-in-inotes-lite-forms
And one which gives more detail on the “lite” architecture:
http://www-10.lotus.com/ldd/dominowiki.nsf/dx/inotes-lite-framework
Subject: Figured it out
The Classic method shows adding the iFrame using insertAdjacentHTML. This works for IE, but not FF. I had gone through the steps of creating an iFrame and appending it. The one important piece that I missed was not setting the name of the iFrame to “myAgentFrame”. Also, this means that the target for the form should be myAgentFrame. Works like a champ.
Next time I’m making DWA modifications, I will use the Lite techniques.
Subject: Try using XHR
Try using XHR instead of hidden