FORUM PLAN UPDATE
Date revision: This forum will remain open to new posts and responses until December 1, 2018. (After that date, you will still be able to view and search the forum.) Also, we're taking a second look at the best place to host future conversation. For now, keep using this forum, and stay tuned for more news.



Oct 23, 2013, 5:23 AM
261 Posts

1 field and a button

  • Category: Server Side JavaScript
  • Platform: Windows
  • Release: 9.0
  • Role: Developer
  • Tags:
  • Replies: 2

Hi,

Add a field to your XPage and a button. Mark the field as required. By default if you click a button, all fields will be validated first, so on the field's onclick event, you can directly add the code to run the agent ( session.getAgent("nameOfAgent").run() ) and save the document ( doc.save() ). 

If you need to pass parameters to the agent, use the .runWithDocumentContext() method.

I made some assumptions in my answer, so you might to tweak it for your situation.

Mark


FORUM PLAN UPDATE
Date revision: This forum will remain open to new posts and responses until December 1, 2018. (After that date, you will still be able to view and search the forum.) Also, we're taking a second look at the best place to host future conversation. For now, keep using this forum, and stay tuned for more news.