Record Actions
Custom actions for records, called record actions, are invoked by a user on one or more specific records from the UI or API. You can configure custom record actions as any of the following:
-
User Action: Custom actions for records, called record actions or record user actions, are invoked by a user on a specific record from the UI or API. Learn more about Object User Actions in Vault Help
. Note that if your object has types, you may wish to add the action to these object types. Learn more about assigning user actions to object types in Vault Help . -
User Bulk Action: Bulk actions allow users to make changes to up to 1,000 object records at once from the Vault UI. Bulk actions cannot be annotated as any other type of action. If a user updates more than 500 records with a custom bulk action, Vault splits the update into two separate SDK transactions: one containing the first 500 records and a second containing the remainder. If one transaction throws a
RollbackException, it does not rollback the other transaction. Learn more about bulk object record actions in Vault Help. -
Lifecycle User Action: Actions invoked by a user on a specific object lifecycle state, from the UI or API. You can configure these actions in the Object Lifecycle configuration. Learn more about Object Lifecycle User Actions in Vault Help
. -
Entry Action: Actions automatically invoked when an object record enters a particular lifecycle state. You can configure these actions in the Object Lifecycle configuration. Learn more about Object Record Entry Actions in Vault Help
. -
Event Action: Actions automatically invoked when a user creates an object record. You can configure these actions in the Object Lifecycle configuration. Learn more about Object Record Event Actions in Vault Help
. -
System Action Step: Actions automatically invoked when an object record enters a particular workflow step. You can configure these actions during workflow configuration. Learn more about configuring system steps on object workflows in Vault Help
. -
Workflow Cancellation: Actions automatically invoked when a workflow is cancelled. You can configure these actions during workflow configuration. Learn more about cancellation actions in Vault Help
.
Implementing Record Action
Section link for Implementing Record ActionIn order to implement a custom action, the RecordAction interface requires implementing the following two methods:
isExecutable(): Optional: Returntrueto make the configured action visible and executable, orfalseto make the configured action hidden and unexecutable. This method is often used to check the current record field values, Admin configured parameter values, and user's group/role membership in order to return true or false. Defaults totrueif the method is not explicitly implemented.execute(): Add your action logic in this method. Here you can make updates to the current record, create new records, or use any of the Vault Java SDK services to interact with other records or documents. As a best practice, you should create a user-defined service containing action logic, which you can then invoke in one or more record actions.
The @RecordActionInfo class annotation is also required to indicate this class is an action.
label: Label of this action. This is the label which appears for Vault Admins during action configuration, and is different from the label provided to end-users who run this action.object: If specified, the action is available for the specified object only. If omitted, the action is available across all objects.usages: If specified, the action is available for configuring in the specified usages only. For example,USER_ACTION. If omitted, defaults toUNSPECIFIEDwhich means the action is available everywhere actions are supported with the exception of bulk actions. If Vault adds a new record action usage in future releases, code withUNSPECIFIEDusage immediately becomes available for the new usage.user_input_object_type: If your action takes a user input object, you may want to identify the object type using the object type name, for example,base__v. If omitted, it means 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 a user input, object identify the object by its name, for example,product__v. If omitted, it means 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.
If your action updates a document reference field, you must set the Document Version Reference to Specific Version. Learn more in Vault Help
Record Action Pre- and Post-Action UI Behavior
Section link for Record Action Pre- and Post-Action UI BehaviorOptionally, a dialog can be shown in the UI before and after the action execution for a class that implements the RecordAction interface.
-
onPreExecute: This method allows a confirmation dialog to be displayed to the user prior to the execution of a record action. A custom dialog title and message can be added. -
onPostExecute: This method allows a post record action execution banner to be displayed to the user. A custom banner message can be added.
Pre- and post-action dialogs execute as separate transactions. Learn more in the Javadocs
The following is a basic skeleton of a record action:
package com.veeva.vault.custom.actions;
@RecordActionInfo(label="Say Hello", object="hello_world__c", icon="create__sys", usages={Usage.USER_ACTION, Usage.WORKFLOW_STEP})
public class Hello implements RecordAction {
// This action is available for configuration in Vault Admin.
public boolean isExecutable(RecordActionContext context) {
return true;
}
public void execute(RecordActionContext context) {
//action logic goes here
}
}