DWA agent

Does anyone know how to call an Agent from within Domino Web Access?

I have created an action in the Calendar to show a dialog box, the user will select a number of choices and then select OK,

the agent will pick up the choices and create document in the calendar.

the only example I could find of calling an agent is in the ‘Manipulating data in Domino Web Access’ in the developerworks library. In the Customizing the read scene section there is a function called ‘CreateRunAgentHTML()’. I have tried using something similar in the dialogbox form but it did not work.

Any help would be appreciated.

Regards.

David

Subject: RE: Domino Web Access (DWA)

I could not get it to work correctly either, so I wrote an agent in the db and called that from the URL with the ?openagent parameter,

However yr agent must then control the navigation correctly.

Subject: Domino Web Access (DWA)

Thanks, you pointed me in the right direction

Subject: I believe you can accomplish this the same way as you would in any other web app…

We have been working on a similar project, and have been developing a custom solution within DWA.

In the Form design element - “s_CustomEditCode” - associated with our custom form, we created a function that adds a menu option to the forms action bar…

function kk(){

Nv(“Do This”, “javascript:doThis()”, ‘Perform an action’, false, 20);

}

Now, the user can trigger the custom function by simply clicking the action button atop the form.

Within that custom function, we simply use javascript code to validate the form data and generate an XMLHTTPRequest (this is a very cut-down example)…

function doThis() {

var dbURL = new String( location.href.slice( 0, location.href.indexOf( ‘.nsf’ ) + 4 ) );

var aURL = dbURL + “/(CustomAgent)?OpenAgent”;

var thisDoc = document.forms[0];

var parameters = “&par1=@{@Name([Abbreviate];@UserName)}&par2=” + thisDoc.Field1.value + “&”;

xmlhttp = getXMLHTTP();

xmlhttp.onreadystatechange = manageChange;

xmlhttp.open( “POST”, aURL, true );

try {

xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");

xmlhttp.setRequestHeader("Content-length", parameters.length);

xmlhttp.setRequestHeader("Connection", "close");

xmlhttp.send(parameters);

} catch (e) {

alert( "Could not process at this time.");

}

}

We then collect the agent results and display them back to the user (typical AJAX stuff).

Obviously, you can simply call the agent and redirect the user to another page (or close the existing window).

Sure hope that helps you out!

Cheers,

T.