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


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.