Skip navigation links

Package com.veeva.vault.sdk.api.integration

This package provides interfaces to build Vault-to-Vault integration which require data mapping.

See: Description

Package com.veeva.vault.sdk.api.integration Description

This package provides interfaces to build Vault-to-Vault integration which require data mapping.

Spark Integration Rules

Spark Integration Rules allow developers to use configurable rules for mapping object and document fields for Vault-to-Vault integrations. Users must first set up Integrationrule components, which are configurable rule sets for field mapping, reference lookup, and field defaulting. Once configured, you can evaluate integration rules within a MessageProcessor using the services in this package.

Please contact Veeva Support to set up Integrationrule components.


The following is a simple example of mapping data. The source vault retrieves data through HTTP Callout and maps it to the desired format in the target vault.
      // Locate service
      IntegrationRuleService integrationRuleService = ServiceLocator.locate(IntegrationRuleService.class);

      // Create and send HTTP Callout request
      HttpRequest request = httpService.newHttpRequest("connectionName");
      request.setHeader("Content-Type", "application/x-www-form-urlencoded");
      request.setHeader("X-VaultAPI-DescribeQuery", "true");
      request.setBodyParam("q", "select id, name__v from source_object__c");

      httpService.send(request, HttpResponseBodyValueType.JSONDATA).onSuccess(httpResponse -> {
          JsonData response = httpResponse.getResponseBody();
          if (response.isValidJson()) {
              String responseStatus = response.getJsonObject().getValue("responseStatus", JsonValueType.STRING);
              if (responseStatus.equals("SUCCESS")) {
                  JsonArray data = response.getJsonObject().getValue("data", JsonValueType.ARRAY);
                  JsonObject queryDescribe = response.getJsonObject().getValue("queryDescribe", JsonValueType.OBJECT);

                  // Get integration rule for this connection
                  IntegrationRule integrationRule = (integrationRuleService.getIntegrationRules(connectionId)).iterator().next();

                  for (int i = 0; i < data.getSize();i++) {
                      JsonObject queryRecord = data.getValue(i, JsonValueType.OBJECT);

                      // Get the resulting values for a row based on the evaluation of the rule against a json query response record
                      Collection<FieldRuleResult> fieldRuleResults = integrationRuleService.evaluateFieldRules(integrationRule, "target_name__c", queryDescribe, queryRecord);

                      // Create new record in target vault using values in "fieldRuleResults"
                      Record r = recordService.newRecord(“targetName__c”)
                      for (Iterator<String> iterator = fieldRuleResults.iterator(); iterator.hasNext();) {
                          FieldRuleResult fieldRuleResult =;
                          r.setValue(fieldRuleResult.getTargetField(), fieldRuleResult.getValue());

Skip navigation links

Copyright © Veeva Systems 2017–2019. All rights reserved.