Skip to content

Learn how to set up the Vault Toolbox plugin for IntelliJ IDEA. This tutorial will then walk you through how to use Vault Toolbox to create and deploy a record trigger to Vault.

In this tutorial, you will learn how to:

  • Install the Vault Toolbox IntelliJ plugin
  • Create a new project
  • Authenticate to Vault
  • Use file and live templates to create a RecordTrigger
  • Deploy the RecordTrigger to Vault
  • Download the SDK Debug Log

To follow this tutorial, you need:

  • IntelliJ IDEA v2024.3 or higher available from JetBrains downloaded and installed
  • A sandbox Vault with Vault Owner permissions, API access, and the Product (product__v) object
  • A debug log session enabled for your user account, with the Log Level scoped to ALL or DEBUG

To install the Vault Toolbox plugin:

  1. Download the latest version of the Vault Toolbox IntelliJ Plugin from the JetBrains Marketplace. Alternatively, you can install it from IntelliJ IDEA by navigating to Settings > Plugins > Marketplace, searching for "Vault Toolbox", and clicking Install.
  2. Launch IntelliJ IDEA.
  3. From the left sidebar, select Plugins.
  4. Click the gear () icon and select Install Plugin from Disk…
  5. Navigate to the Vault Toolbox IntelliJ Plugin .jar file downloaded and click Open.
  6. Under the Installed tab, verify that the new plugin, Vault Toolbox, is enabled. If not enabled by default, enable the plugin by selecting the checkbox.
Installing the IntelliJ PluginInstalling the IntelliJ Plugin

Next, you will create a new project in IntelliJ IDEA from one of Vault Toolbox's available generators. Generators set up your project with the necessary configurations and dependencies. See the list of available generators for Vault Toolbox projects.

IntelliJ Plugin Creating a New ProjectIntelliJ Plugin Creating a New Project

To create a new project:

  1. Select Projects from the left sidebar, then select New Project.
  2. From the left sidebar of the dialog, underneath Generators, select Vault Java SDK Hello World.
  3. Populate the Project name with "sdk-hello-world" and confirm the Project location.
  4. Click Create.

Your Vault Java SDK Hello World project is now available with Vault Toolbox tools already configured.

Prior to using Vault Toolbox's tools, you must authenticate to Vault.

To authenticate using basic login:

  1. In IntelliJ IDEA, open the Vault Toolbox plugin from the righthand sidebar.
  2. Select the tab.
  3. For this Quickstart, select the Basic tab. See Authenticating to Vault to learn more about the available authentication methods.
  4. Enter your Vault DNS, Username, and Password. Alternatively, click to load a saved credential.
    IntelliJ Plugin Basic LoginIntelliJ Plugin Basic Login
  5. Click Login. At the bottom of the panel, Vault Toolbox prompts you to save these credentials.
  6. Optional: Click Yes to save these credentials. Provide a Credential label and click Save.

You've now successfully authenticated to Vault.

The following sections guide you through creating a RecordTrigger named MyHelloWorld from a file template, then customizing it with a live template.

The MyHelloWorld record trigger executes at the BEFORE_INSERT event on the product__v object. This means the trigger will execute custom code right before an object record is saved, and that this trigger only executes on product__v object records. When triggered, the custom code written for the MyHelloWorld trigger will send a DEBUG type message to your Vault's Debug Log.

Vault Toolbox includes file templates for all Vault Platform SDK entry points that specify the default contents for new files you create within your project.

To create a RecordTrigger from a file template:

  1. Right-click the src/main/java/com/veeva/vault/custom/triggers folder within your sdk-hello-world project.
  2. Hover over New, and select the Vault Java SDK RecordTrigger file template.
    IntelliJ Plugin MyHelloWorld TriggerIntelliJ Plugin MyHelloWorld Trigger
  3. In the dialog, populate the fields with the following values:
    1. Name: MyHelloWorld
    2. Object: product__v
    3. Description: A RecordTrigger for the Product object.
  4. Click OK.

Within the triggers folder, this action creates a file named MyHelloWorldTrigger.java. The new file includes the initial formatting necessary for a RecordTrigger, pre-populated with values from the fields prompted for previously. As shown in the screenshot below, if you provide product__v as the Object, the class is defined with object = "product__v".

IntelliJ Plugin MyHelloWorld TriggerIntelliJ Plugin MyHelloWorld Trigger

Vault Toolbox includes live templates for creating snippets of Vault Java SDK code within an entry point.

To customize your RecordTrigger with live templates:

  1. Add the following import statements:
    import com.veeva.vault.sdk.api.core.LogService; import com.veeva.vault.sdk.api.core.ServiceLocator;
  2. Within the MyHelloWorldTrigger.java file, remove the auto-generated comments inside the for loop in the execute() method (lines 25-27).
  3. Next, we will replace this logic with our own custom logic using a live template. Inside the for loop in the execute() method, begin manually typing sdk_debug_log and select it in the dropdown that appears. A code snippet appears, utilizing the LogService interface to send a message to the Debug Log.
  4. Insert the text "Hello World" into the debug() method, as shown below.
    LogService logService = ServiceLocator.locate(LogService.class); logService.debug("Hello World");
  5. Save your MyHelloWorldTrigger.java file.

Next, you will deploy your MyHelloWorld trigger to your Vault.

To test your MyHelloWorld trigger, you must first deploy it to your Vault. While Vault Toolbox includes tools to assist with designing, building, and deploying custom configuration migration packages, this quickstart will utilize a user action to simplify the process.

To deploy your MyHelloWorld trigger to Vault, right-click on the MyHelloWorldTrigger.java file in your project directory and select Veeva Vault > Deploy to Vault (). A dialog appears confirming a successful deployment. To verify that your record trigger has deployed, log in to the Vault UI and navigate to Admin > Configuration > Record Triggers. The VPK you deployed should be visible in the list with the name com.veeva.vault.custom.triggers.MyHelloWorldTrigger and a Operational Status of Enabled.

Deploy the Record TriggerDeploy the Record Trigger

The SDK Debug Log contains the execution details and Vault messages for custom Vault Java SDK code at the user level. The deployed MyHelloWorld record trigger executes right before a Product (product__v) object record is saved, sending the DEBUG type message, "Hello World", to your Vault's Debug Log.

A Vault Admin must already have configured a Debug log session for your user via the Vault UI or the Vault Toolbox plugin. To test your trigger, you must create a Product record in Vault and verify the result by downloading the debug log.

  1. After creating a Product record via the Vault UI, navigate back to IntelliJ IDEA.
  2. Within IntelliJ IDEA, open the Vault Toolbox plugin from the righthand sidebar.
  3. Select the tab.
  4. Expand Developer Logs () and double-click SDK Debug ().
    IntelliJ Plugin Download and Analyze SDK Debug LogIntelliJ Plugin Download and Analyze SDK Debug Log
  5. In the dialog, select the debug log session for your user account. If the list is empty, a Vault Admin should create a new debug log session using the Vault Toolbox plugin.
  6. Click to download the selected log.
  7. In the dialog, previously downloaded logs are differentiated by a within the View column. To proceed with analyzing the debug log, select the checkbox for the downloaded log, then click . The CSV file of the analysis will then open in your preferred spreadsheet application.
IntelliJ Plugin Downloaded SDK Debug LogIntelliJ Plugin Downloaded SDK Debug Log

Once the operation is complete, you can access the downloaded SDK Debug Log .zip file from the toolbox/logs/debug/{vaultid} folder and the analysis files from toolbox/logs/debug/{vaultid}/debug_analysis in your project directory. Open the CSV, locate the row with a type of DEBUG, and verify that the message column reads Hello World.

Congratulations! You've successfully set up the Vault Toolbox plugin for IntelliJ IDEA and used its functionality to create custom SDK code, deploy it to Vault, and download the Debug Log.