-
Notifications
You must be signed in to change notification settings - Fork 2
Home
The vsdk-user-defined-model-sample project demonstrates the creation and use of the user-defined model(UDM). User-defined models allow developers to create reusable data access objects, or models, and annotate their getters and setters as user-defined properties. You can use user-defined models with the JsonService to translate data to and from JSON, or with HttpService to send and receive data using REST APIs.
This project will demonstrate how to define and use User-defined models with the QueryService to handle Query responses. Additionally, it will demonstrate how to use User-defined models with the HTTPService to send and receive data. Furthermore, it will demonstrate how to translate data to and from JSON using the JsonService and User-defined models.
This project contains the following Objects, User-defined Models and Triggers:
- vSDK Setting (vsdk_setting__c): An object that contains the custom sdk job settings that the trigger will fetch
-
vSDK UDM Example (vsdk_udm_example__c): The object on whose
BEFORE_CREATE
andBEFORE_UPDATE
the trigger will execute
- SettingRecord Model: A User-defined model that represents a single vsdk_setting__c record from a remote vault
- ExampleSettings Model: A User-defined Model that represents the settings from Vault
- RemoteSettingResponse Model: A User-defined model that represents a VQL query response with data from Vault
- CustomSettingService: A User-defined Service used to get and create local and remote vSDK Settings records.
-
ExampleUDMTrigger: A Record Trigger which executes on the
BEFORE_INSERT
orBEFORE_UPDATE
event on the vSDK UDM Example Object
The project contains two separate vault packages (VPK) in the deploy-vpk
directory with the necessary Objects, Triggers and Models required for this project.
- Clone or download the sample Maven project vSDK User Defined Service Sample project from Github.
- Run through the Getting Started guide to setup your development environment.
- Log in to your vault and navigate to Admin > Deployment > Inbound Packages and click Import:
- Locate and select the following file in your downloaded project file:
Deploy vault components: Select the \deploy-vpk\components\vsdk-user-defined-model-sample-components.vpk file.
- From the Actions menu (gear icon), select Review & Deploy. Vault displays a list of all components in the package. You can safely ignore any warnings that may appear.
Review the prompts to deploy the package. You will receive an email when vault completes the deployment.
- Repeat steps 3-6 for the vault code:
Custom Trigger code: \deploy-vpk\code\vsdk-user-defined-model-sample-code.vpk file.
Note: Steps 7- require you to have another Vault in which you will need to have also imported the Vault components for this project. Please repeat steps 3-6 in the second Vault.
- Navigate to Admin > Connections and click the Create button. Create a Vault to Vault connection with the following values:
Name: Remote Connection API Name: remote_connection Authorized Connection User: Your Vault User from the picklist
- Download the Connection file from your newly created connection from the Actions menu (gear icon) and clicking the Download Connection File option
-
Repeat Step 7 in your remote vault
-
Upload the Connection File from Step 8 by clicking the Connect From File option in the the Actions menu (gear icon) of your connection from Step 9.
-
Approve the connection in both vaults.
To run the project, create a new vSDK User-Defined Model Object by navigating to Admin > Business Admin > vSDK UDM Examples. Create a vSDK UDM Example, specify a name and select the Remote Connection as created in the steps prior. You will see the results update with the vSDK Setting values from the local and remote vaults.
Home
Trigger
User-Defined Service
User-Defined Models