The Event Handler section of Form Setting is used to define the advanced features that can be performed from within the documents created using this form. Custom functionality can be implemented using Java API. Custom Functionality is initiated when specific events occur on the document. It is to be noted that if the Form Builder has any formulas or scripts defined then those formulas are executed in combination of the Java API and care must be taken so that both the Form Builder formulas and Java API without conflicting with one another.

  • Java API: Each form setting can have a custom Java Class defined, the class (Java Class) acts as an event handler for the documents created based on this form.

A custom class should be used when a specific functionality is needed on certain events. For example, you can implement a custom handler that overrides the afterSave() method. This method of implementation will be executed each time the document is saved successfully. 

  • The following events can be overridden:
  • afterOpen(): Write a Java method indicating an action, which will be performed after opening the document. This event is typically used to set the default values for text, number, keywords, names, and date/time fields whenever a document is opened.
  • beforeSave(): Write a Java method indicating an action, which will be executed before a document is saved. This can be used to set field values, run integration or to do validation of field values and stop a save from occurring until those values are corrected. 
  • afterSave(): Write a Java method indicating an action, which will be executed after a document is saved. This event is typically used to set run integrations as it is too late to run validations or set field values (as they may not be saved as the save has already occurred). 
  • afterRefresh(): Write a Java method indicating an action, which will be executed once the document is refreshed. For instance, after clicking [Refresh], the values of a cost field can be re-calculated.


To learn more about the Java API follow the API Training Presentation.