Last date modified: 2025-Nov-24
Develop object type event handlers
The Relativity platform supports multiple types of event handlers that you can use for interactions with document objects and Relativity Dynamic Objects (RDOs). You can use these object type event handlers to customize workflows and control user activities in the Relativity UI. You can associate these event handlers with specific object types to write custom code for following tasks:
- Validate data entered in their fields.
- Perform mass operations on several instances of an object simultaneously.
- Trigger specific events on the object when users click console buttons.
For information about other event handler types, see Develop application event handlers and Implementing Relativity Forms event handlers.
Using object type event handlers with Relativity Forms
By default, RDOs in Relativity use Relativity Forms. To create event handlers for them, you can either create Page Interaction event handlers using JavaScript, or you can use some of the older object type event handlers listed in the following table.
- For more information on creating Page Interaction event handlers, see Implementing Relativity Forms event handlers.
- For more information on Forms, see Relativity Forms API.
The table below clarifies how Relativity Forms uses or does not use each object type event handler.
|
Object type event handler(s) |
Impact of Relativity Forms |
|---|---|
|
The Object Manager API executes these handlers during its deletions, and by default, Relativity Forms uses Object Manager APIfor its deletions. So by default, Relativity Forms will respect the existence of these Event Handlers, with the following caveat:
|
|
|
The Object Manager API executes these handlers during its reads, and by default, Relativity Forms uses Object Manager APIfor its object instance reads. So by default, Relativity Forms will respect the existence of these Event Handlers, with the following caveats:
|
|
|
The Object Manager API executes these handlers during its saves, (before and after the object is saved, respectively) and by default, Relativity Forms uses Object Manager API for its saves. So by default, Relativity Forms will respect the existence of these Event Handlers. They fire on the server, after the submit pipeline finishes its validation (on submit). If a handler is implemented for the submit pipeline's replaceSave, and something other than the Object Manager API is used for the save, these object type event handlers will not be executed. |
|
|
The existence of a Console event handler associated to an object type will not prevent the type from using Relativity Forms, but Relativity Forms ignores them. To achieve Console behavior in Relativity Forms, implement a handler for the load pipeline's createConsole event. |
|
|
(This does not apply to Classic Forms pages or Relativity Forms pages) |
Using object type event handlers without Relativity Forms
The following table describes how the object type event handlers behave on legacy objects that do not yet use Forms. It also describes how they will be affected if you change the object's Use Relativity Forms field to Yes. For more information, see Relativity Forms API.
| Object type event handler | Brief description | Impact of turning on Relativity Forms |
|---|---|---|
| Console event handler | Executes when the user navigates to the view page of an object. You can add a button to a console. Next, use this event handler to define a custom action that occurs when a user clicks the button. | Console event handlers are ignored when your object type is using Relativity Forms, but the same functionality can achieved within Relativity Forms. |
| Page Interaction event handler | Injects your JavaScript code or loads Cascading Style Sheets (CSS) file on the layout (view, edit, and new) pages of an object. Use this event handler to add specialized behavior to these pages, and control their look and feel. | This type of event handler is treated differently when your object type is using Relativity Forms. The functionality can still be achieved, but script is supplied in a different way. |
| Pre Cascade Delete event handler | Executes when a user attempts to delete an object, which has dependent objects. This event handler ensures that Relativity initiates a forced delete operation only when it can successfully remove the specified objects. Use this event handler to verify that no restrictions exist on an object selected for deletion. | These event handlers are implemented during deletions within Object Manager API, which Relativity Forms uses by default for deletions. If your object is using Relativity Forms, but is not implementing replaceDelete or is using Object Manager API for the deletion, these event handlers will continue to work. |
| Pre Delete event handler | Executes after a user clicks the Delete button or performs a mass delete in the Relativity UI. After Relativity deletes the target object, the event handler commits the delete database transaction. | These event handlers are implemented during deletions within Object Manager API, which Relativity Forms uses by default for deletions. If your object is using Relativity Forms, but is not implementing replaceDelete or is using Object Manager API for the deletion, these event handlers will continue to work. |
| Pre Load event handler | Executes before Relativity loads a new, edit, or view page layout. Use this event handler to populate fields on RDOs and documents with default values. | Pre Load event handlers are implemented during reads within Object Manager API, which Relativity Forms uses by default for reads. If your object is customized via Relativity Forms, but is not implementing replaceRead or is using Object Manager API for the read, Pre Load event handlers will continue to work for view and edit modes. However, as no read is necessary for creating new objects, Relativity Forms will not fire Pre Load event handlers when rendering a Layout for a new object. Additionally, script contained in Response.Message will not be executed by Relativity Forms, as the only supported mechanism for running script in Relativity Forms is via Page Interaction event handler. To pre-populate values when rendering a form for new objects in Relativity Forms, implement replaceGetNewObjectInstance. Any other script which would normally be executed by displaying the Message property of the Pre Load event handler's response should be moved into a Page Interaction event handler, when using Relativity Forms. |
| Pre Mass Delete event handler | Performs a one-time operation on group of objects before Relativity deletes them. You can use this event handler to perform a one-time operation on child objects before deleting them. | These event handlers are implemented during deletions within Object Manager API, which Relativity Forms uses by default for deletions. If your object is using Relativity Forms, but is not implementing replaceDelete or is using Object Manager API for the deletion, these event handlers will continue to work. |
| Pre Save event handler | Executes when the user clicks the Save or Save & Next button on a Relativity layout after changing a value for at least one field. These event handlers run before the data on the object is written to the database. They provide you with the ability to manipulate information before storing it. | These event handlers are implemented during or following saves (creations and updates) within Object Manager API, which Relativity Forms uses by default for saves. If your object is using Relativity Forms, but is not implementing replaceSave or is using Object Manager API for the save, these event handlers will continue to work. |
| Post Save event handler | Executes after a user clicks the Save or Save & Next button on a layout for a document or RDO. This event handler executes after the values entered by the user are written to the database as object properties. Use the Relativity Services API if you later want to modify the object properties, but you can’t update the artifact directly. Use these event handlers to send email notifications, or to instantiate a second object after saving the properties of the original object. | These event handlers are implemented during or following saves (creations and updates) within Object Manager API, which Relativity Forms uses by default for saves. If your object is using Relativity Forms, but is not implementing replaceSave or is using Object Manager API for the save, these event handlers will continue to work. |