Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Triggers and Actions can be used to address a number of business requirements that cannot be configured in vault. This page describes some of the common use cases along with sample code that you can use with your vault to step through the code in the Vault Java SDK Debugger.
The vsdk-object-sample project covers the creation of a vSDK Product record and related vSDK Country Brand records. The project will step through:
- Field defaulting, field validation, and conditionally required fields on the vSDK Product record.
- Creating related vSDK Country Brand records based on the vSDK Region associated with the vSDK Product record.
- The creation of the vSDK Country Brand records will kick off a workflow on each country brand record.
- The completion of the workflow will trigger a state change (update) to the vSDK Country Brand record and it's associated vSDK Product record.
- A custom User Action to change the owner role of a vSDK Product's related vSDK Country Brand records.
- The RequestContextObject class implements Request Context functionality for storing a reusable map of regions to countries.
- The UserDefinedUtils class implements User-Defined Class functionality for throwing batch errors -
throwBatchErrors- and conditionally requiring fields -
UserDefinedUtilsclass also contains an example_type variable that can be set to control functionality in the project. You can set this variable to any of the following. By default, it is set to ALL:
ALL- this will run through all the triggers and initiate workflows and user actions in CountryBrandLifeCycleUserActions.java
NO_WORKFLOW- this will run all triggers but will not run workflows or state changes in CountryBrandLifeCycleUserActions.java.
REQUEST_CONTEXT- this will run through triggers demonstrating
RequestContextfunctionality in ProductInitializeRequestContextValue.java and ProductCreateRelatedCountryBrand.java
- The workflows are evaluated on the vSDK Country Brand records.
The project contains two separate vault packages (VPK) in the
deploy-vpk directory with the necessary Objects, Actions, Lifecycles, Workflows, and custom object actions for the following examples.
The VPKs need to be deployed to your vault prior to debugging these use cases:
- Clone or download the sample Maven project vSDK Object Sample project from GitHub.
- Run through the Getting Started guide to set up your deployment environment.
- Log in to your vault and navigate to Admin > Deployment > Inbound Packages and click Import:
Deploy Object Action code: Select the
- From the Actions menu, select Review & Deploy. Vault displays a list of all components in the package.
- Click Next.
- On the confirmation page, review and click Finish. You will receive an email when Vault completes the deployment.
- Repeat steps 3-6 for the vault components:
Deploy vault components: Select the
Once the package has been deployed, you will want to review the configuration and understand the normal behavior so you can observe the effects of the sample trigger code.
Below is a rundown of the included components.
- vSDK Country (vsdk_country__c)
- vSDK Country Brand (vsdk_country_brand__c)
- vSDK Product (vsdk_product__c)
- vSDK Region (vsdk_region__c)
- Run vSDK Change Owner User Action (vSDKChangeOwnerUserAction.java)
Run the Project
Once the project is in debug or deployed to vault:
- Navigate to your Admin -> Business Admin -> vSDK Product tab in your vault and Create a new record:
- Enter any value in the Name field and select a Region.
- Click Save.
- While vault attempts to save the record, each of the trigger examples discussed in this wiki will execute in order.