Skip to content

Along with the standard document actions you can configure in the Vault UI, you can create custom document actions using the Vault Java SDK to automate more specific business processes. Unlike document actions created through the Vault UI, custom document actions can run multiple sequential actions within one action, and can execute more complex conditional logic.

You can configure the following types of custom document actions:

  • User Action: Actions invoked by a user on a specific document lifecycle state, from the UI or API. Such actions are configured in the Document Lifecycle configuration. Learn more about Document User Actions in Vault Help.
  • Entry Action: Actions automatically invoked when a document enters a particular lifecycle state. Such actions are configured in the Document Lifecycle configuration. Learn more about Document Entry Actions in Vault Help.

You can find examples of document actions in our Sample Code.

A document action is a Java class that implements the DocumentAction interface and has the @DocumentActionInfo annotation.

The DocumentAction interface requires implementing the following two methods:

  • isExecutable(): Optional: Return true to make the configured action visible and executable. For example, you could check the current document field values or a user’s role membership in order to determine if this method should return true or false. Defaults to true if this method is not explicitly implemented.
  • execute(): Add your action logic in this method. Here you can make updates to the current document or use any of the Vault Java SDK services to interact with other documents or records.

The @DocumentActionInfo class annotation requires the following:

  • label: Label of the action. This label appears for Vault Admins during action configuration. This is not the label users see when running the action.
  • lifecycle: Specifies for which lifecycle the action is available. If omitted, the action is available across all document lifecycles.
  • usage: Specifies for which usages the action is available for configuring. For example, USER_ACTION. If omitted, defaults to UNSPECIFIED, which means the action is available everywhere actions are supported with the exception of bulk actions. If Vault adds new usages for record actions in future releases, such as WORKFLOW_STEP, actions with UNSPECIFIED usage immediately become available for the new usage.
  • user_input_object_type: If your action takes user input, you may want to identify the user input object type. If omitted, this action does not require a type for user input. Actions which require user input may not require a type.
  • user_input_object: If your action takes user input, identify the user input object. If omitted, this action does not require user input.
  • icon: The icon which appears in the Vault UI Action Bar for this action. Learn more about action icons.

Document Action Pre- and Post-Action UI Behavior

Section link for Document Action Pre- and Post-Action UI Behavior

Optionally, a dialog can be shown in the UI before and after the action execution for a class that implements the DocumentAction interface.

  • onPreExecute: This method allows a confirmation dialog to be displayed to the user prior to the execution of a document action. A custom dialog title and message can be added. *onPostExecute: This method allows a post document action execution banner to be displayed to the user. A custom banner message can be added.

Learn more about pre- and post-action dialogs in the Javadocs.

The following is a basic skeleton of a document action:

package com.veeva.vault.custom.actions; @DocumentActionInfo(label="Set Expiration", usage="LIFECYCLE_ENTRY_ACTION", icon="update__sys") public class SetDocumentExpiration implements DocumentAction { // This action is available for configuration in Vault Admin. public boolean isExecutable(DocumentActionContext context) { return true; } public void execute(DocumentActionContext context) { //action logic goes here } }