Class ObjectRecordRequest

java.lang.Object
com.veeva.vault.vapil.api.request.VaultRequest<ObjectRecordRequest>
com.veeva.vault.vapil.api.request.ObjectRecordRequest

public class ObjectRecordRequest extends VaultRequest<ObjectRecordRequest>
Object Record Requests
  • CRUD operations (single and bulk)
  • Object Types
  • Object Roles
  • Cascade Deletes
  • Deep Copy
  • Other Object Record requests

The following properties can be set for a variety of input/output options to the request, leveraging builder pattern setters.

  • Header Content-Type (JSON, CSV)
  • Header Accept Return (JSON, CSV)
  • Request content (JSON/CSV File or String, XFORM Body)
  • Migration mode parameter
  • Upsert parameter (idParam)
  • The execute method to hit the API endpoint

Example create request with input CSV file, receiving JSON response:

 ObjectRecordResponse resp = vaultClient.newRequest(ObjectRecordRequest.class)
                        .setContentTypeCsv()
                        .setInputPath(inputPath)
                        .createObjectRecords(objectName);
Vault API Coverage:
https://developer.veevavault.com/api/25.1/#vault-objects

The following endpoints are covered in other classes for ease of use

  • Field Details

    • HTTP_HEADER_VAULT_MIGRATION_MODE

      public static final String HTTP_HEADER_VAULT_MIGRATION_MODE
      X-VaultAPI-MigrationMode Set to true to create object records in a specific state or state type.
      See Also:
    • HTTP_HEADER_VAULT_NO_TRIGGERS

      public static final String HTTP_HEADER_VAULT_NO_TRIGGERS
      X-VaultAPI-NoTriggers When set to true, it bypasses all system, standard, and custom triggers when using Record Migration Mode.
      See Also:
    • HTTP_HEADER_VAULT_UNCHANGED_FIELD_BEHAVIOR

      public static final String HTTP_HEADER_VAULT_UNCHANGED_FIELD_BEHAVIOR
      X-VaultAPI-UnchangedFieldBehavior When upserting, set to IgnoreSetOnCreateOnly to ignore values given for the Object Type field and parent object fields if the record already exists and the value has not changed. Set to NeverIgnore to enforce edit permission for all fields in the payload, regardless of whether or not the value has changed. Read-only fields such as Object Type will fail even if the value has not changed. Set to AlwaysIgnore to ignore fields that match between the record and payload values during upsert.
      See Also:
    • ID_PARAM

      public static final String ID_PARAM
      If you’re identifying object records in your input by a unique field, add idParam={fieldname} to the request endpoint.
      See Also:
  • Method Details

    • retrieveObjectRecordCollection

      public ObjectRecordCollectionResponse retrieveObjectRecordCollection(String objectName)
      Retrieve Object Record Collection

      Retrieve all records for a specific Vault Object.

      Parameters:
      objectName - The object name for the operation
      Returns:
      ObjectRecordCollectionResponse
      Vault API Endpoint:
       GET /api/{version}/vobjects/{object_name}
      Vault API Help Link:
      https://developer.veevavault.com/api/25.1/#retrieve-object-record
      Example Request:
       ObjectRecordResponse response = vaultClient.newRequest(ObjectRecordRequest.class)
                                              .retrieveObjectRecordCollection(objectName);
      Example Response:
       System.out.println(resp.getResponse());
       }
    • retrieveObjectRecordCollectionByPage

      public ObjectRecordCollectionResponse retrieveObjectRecordCollectionByPage(String pageUrl)
      Retrieve Object Record Collection (By Page)

      Retrieve all records using the previous_page or next_page parameter of a previous request

      Parameters:
      pageUrl - The URL from the previous_page or next_page parameter
      Returns:
      ObjectRecordCollectionResponse
      Vault API Endpoint:
      GET /api/{version}/vobjects/{object_name}/?offset={offset}
      Vault API Help Link:
      https://developer.veevavault.com/api/25.1/#retrieve-object-record
      Example Request:
       ObjectRecordResponse response = vaultClient.newRequest(ObjectRecordRequest.class)
                              .retrieveObjectRecordCollectionByPage(pageUrl);
      Example Response:
       System.out.println(resp.getResponse());
       }
    • retrieveObjectRecord

      public ObjectRecordResponse retrieveObjectRecord(String objectName, String recordId)
      Retrieve Object Record

      Single record transaction - Retrieve metadata (and values) configured on a single/specific object record.

      Use bulk for multiple records

      Parameters:
      objectName - The object name for the operation
      recordId - The record id to get
      Returns:
      ObjectRecordResponse
      Vault API Endpoint:
       GET /api/{version}/vobjects/{object_name}/{object_record_id}
      Vault API Help Link:
      https://developer.veevavault.com/api/25.1/#retrieve-object-record
      Example Request:
       ObjectRecordResponse resp = vaultClient.newRequest(ObjectRecordRequest.class)
                                              .retrieveObjectRecord(objectName, id);
      Example Response:
       System.out.println(resp.getResponse());
       ObjectRecord objectRecord = resp.getData();
      
       System.out.println("Id = " + objectRecord.getId());
       System.out.println("Name = " + objectRecord.getName());
      
       Map<String,Object> additionalFields = objectRecord.getProperties();
       for (String name : additionalFields.keySet())
       System.out.println(name + " = " + additionalFields.get(name));
      
       for (String roleName : resp.getManuallyAssignedSharingRoles().keySet()) {
         System.out.println("\nRole " + roleName);
      
         Map<String,Object> role = (Map<String, Object>) resp.getManuallyAssignedSharingRoles().get(roleName);
      
         List<Integer> groups = (List<Integer> ) role.get("groups");
         List<Integer>  users = (List<Integer> ) role.get("users");
      
         if (groups != null) {
           for (Integer groupId : groups)
           System.out.println("Group = " + groupId);
           }
      
         if (users != null) {
           for (Integer userId : users)
           System.out.println("User = " + userId);
           }
         }
       }
    • createObjectRecords

      public ObjectRecordBulkResponse createObjectRecords(String objectName)
      Create Object Records

      Create Object Records in bulk based on the set properties of the class. The maximum batch size is 500 records. Note that it is up to the calling code to batch the data.

      Parameters:
      objectName - The object name for the operation
      Returns:
      ObjectRecordResponse
      Vault API Endpoint:
       POST /api/{version}/vobjects/{object_name}
      Vault API Help Link:
      https://developer.veevavault.com/api/25.1/#create-object-records
      Example Request:
       Example 1 - Source - CSV file, Response - JSON
       ObjectRecordBulkResponse resp = vaultClient.newRequest(ObjectRecordRequest.class)
                                      .setContentTypeCsv()
                                      .setInputPath(inputPath)
                                      .createObjectRecords(objectName);
      ,
       Example 2 - Source - CSV file, Response - CSV
       ObjectRecordBulkResponse resp = vaultClient.newRequest(ObjectRecordRequest.class)
                                      .setContentTypeCsv()
                                      .setAcceptCSV()
                                      .setInputPath(inputPath)
                                      .createObjectRecords(objectName);
      ,
       Example 3 - Source - CSV file, Response - JSON, Upsert operation with idParam
       ObjectRecordBulkResponse resp = vaultClient.newRequest(ObjectRecordRequest.class)
                                      .setContentTypeCsv()
                                      .setIdParam(idParam)
                                      .setInputPath(inputPath)
                                      .createObjectRecords(objectName);
      ,
       Example 4 - Source - CSV file, Response - JSON, Migration Mode
       ObjectRecordBulkResponse resp = vaultClient.newRequest(ObjectRecordRequest.class)
                                      .setContentTypeCsv()
                                      .setMigrationMode(true)
                                      .setInputPath(inputPath)
                                      .createObjectRecords(objectName);
      ,
       Example 5 - Source - JSON string, Response - JSON
       ObjectRecordBulkResponse resp = vaultClient.newRequest(ObjectRecordRequest.class)
                                      .setContentTypeJson()
                                      .setRequestString(requestString)
                                      .createObjectRecords(objectName);
      Example Response:
       System.out.println(resp.getResponse());
      
       if (resp.hasErrors()) {
         System.out.println("Errors exist");
      
         if (resp.getErrors() != null) {
           for (VaultResponse.APIResponseError e : resp.getErrors())
             System.out.println("VaultResponse Error " + e.getMessage());
           }
       }
       if (resp.getErrors() == null) {
         for (ObjectRecordResponse objectRecordResponse : resp.getData()) {
           System.out.println("Record successful? " + objectRecordResponse.isSuccessful());
      
           if (objectRecordResponse.isSuccessful())
             System.out.println(objectRecordResponse.getData().getId() + " " + objectRecordResponse.getData().getUrl());
      
           if (objectRecordResponse.getErrors() != null) {
             for (VaultResponse.APIResponseError error : objectRecordResponse.getErrors()) {
               System.out.println("Error " + error.getType() + " " + error.getMessage());
             }
           }
         }
       }
    • recalculateRollupFields

      public VaultResponse recalculateRollupFields(String objectName)
      Recalculate Roll-up Fields
      Parameters:
      objectName - The name of the object on which to start the Roll-up field recalculation.
      Returns:
      VaultResponse
      Vault API Endpoint:
       POST /api/{version}/vobjects/{object_name}/actions/recalculaterollups
      Vault API Help Link:
      https://developer.veevavault.com/api/25.1/#recalculate-roll-up-fields
      Example Request:
       VaultResponse response = vaultClient.newRequest(ObjectRecordRequest.class)
                      .recalculateRollupFields(objectName);
       
      Example Response:
       System.out.println("Response Status: " + response.getResponseStatus());
       
    • retrieveRollupFieldRecalculationStatus

      public JobStatusResponse retrieveRollupFieldRecalculationStatus(String objectName)
      Retrieve Roll-up Field Recalculation Status
      Parameters:
      objectName - The name of the object on which to start the Roll-up field recalculation.
      Returns:
      JobStatusResponse
      Vault API Endpoint:
       GET /api/{version}/vobjects/{object_name}/actions/recalculaterollups
      Vault API Help Link:
      https://developer.veevavault.com/api/25.1/#retrieve-roll-up-field-recalculation-status
      Example Request:
       JobStatusResponse response = vaultClient.newRequest(ObjectRecordRequest.class)
                      .retrieveRollupFieldRecalculationStatus(objectName);
       
      Example Response:
       System.out.println("Job Status: " + response.getData().getStatus());
       
    • updateObjectRecords

      public ObjectRecordBulkResponse updateObjectRecords(String objectName)
      Update Object Records

      Update Object Records in bulk based on the set properties of the class. The maximum batch size is 500 records. Note that it is up to the calling code to batch the data.

      Parameters:
      objectName - The object name for the operation
      Returns:
      ObjectRecordResponse
      Vault API Endpoint:
       PUT /api/{version}/vobjects/{object_name}
      Vault API Help Link:
      https://developer.veevavault.com/api/25.1/#update-object-records
      Example Request:
      See createObjectRecords(String) for example requests (replace "createObjectRecords" with "updateObjectRecords")
      Example Response:
      See createObjectRecords(String) for example responses (replace "createObjectRecords" with "updateObjectRecords")
    • deleteObjectRecords

      public ObjectRecordBulkResponse deleteObjectRecords(String objectName)
      Delete Object Records

      Bulk delete object records. The maximum batch size is 500. Note that it is up to the calling code to batch the data.

      Parameters:
      objectName - The object name for the operation
      Returns:
      ObjectRecordResponse
      Vault API Endpoint:
       DELETE /api/{version}/vobjects/{object_name}
      Vault API Help Link:
      https://developer.veevavault.com/api/25.1/#delete-object-records
      Example Request:
       Example 1 - Source - CSV file, Response - JSON
       ObjectRecordBulkResponse resp = vaultClient.newRequest(ObjectRecordRequest.class)
                                      .setContentTypeCsv()
                                      .setInputPath(inputPath)
                                      .deleteObjectRecords(objectName);
      ,
       Additional Requests
       See createObjectRecords(String) for additional example requests (replace "createObjectRecords" with "deleteObjectRecords")
      Example Response:
      See createObjectRecords(String) for example responses (replace "createObjectRecords" with "deleteObjectRecords")
    • cascadeDeleteObjectRecord

      public JobCreateResponse cascadeDeleteObjectRecord(String objectName, String id)
      Cascade Delete Object Record

      Submit a job to perform a cascade delete. The corresponding job id can be retrieved from the response via the "getJobId" method.

      Parameters:
      objectName - The object name for the operation
      id - The record id to delete
      Returns:
      JobCreateResponse
      Vault API Endpoint:
       POST /api/{version}/vobjects/{object_name}/{object_record_id}/actions/cascadedelete
      Vault API Help Link:
      https://developer.veevavault.com/api/25.1/#cascade-delete-object-record
      Example Request:
       JobCreateResponse resp = vaultClient.newRequest(ObjectRecordRequest.class)
                                      .cascadeDeleteObjectRecord(objectName, id);
      Example Response:
       System.out.println(resp.getResponse());
       System.out.println("Job Id = " + resp.getJobId());
    • getResultsOfCascadeDeleteJob

      public VaultResponse getResultsOfCascadeDeleteJob(String objectName, String jobStatus, int jobId)
      Get Results of Cascade Delete Job

      After submitting a request to deep copy an object record, query vault to determine the results of the request.

      Parameters:
      objectName - The object name for the operation
      jobStatus - "success" or "failure"
      jobId - The ID of the job, retrieved from the response of the job request
      Returns:
      The VaultResponse in CSV byte array
      Vault API Endpoint:
       GET /api/{version}/vobjects/cascadedelete/results/{object_name}/{job_status}/{job_id}
      Vault API Help Link:
      https://developer.veevavault.com/api/25.1/#get-results-of-cascade-delete-job
      Example Request:
       VaultResponse resp = vaultClient.newRequest(ObjectRecordRequest.class)
                                      .getResultsOfCascadeDeleteJob(objectName, "success", jobId);
      Example Response:
       System.out.println(new String(resp.getBinaryContent()));
    • retrieveDetailsFromAllObjectTypes

      public ObjectRecordTypeBulkResponse retrieveDetailsFromAllObjectTypes()
      Object Types - Retrieve Details from All Object Types
      Returns:
      Describes of all object types
      Vault API Endpoint:
       GET /api/{version}/configuration/Objecttype
      Vault API Help Link:
      https://developer.veevavault.com/api/25.1/#retrieve-details-from-all-object-types
      Example Request:
       ObjectRecordTypeResponse resp = vaultClient.newRequest(ObjectRecordRequest.class)
                                      .retrieveDetailsFromAllObjectTypes();
      Example Response:
       System.out.println("Total Object Types = " + response.getResponseDetails().getTotal());
       for (ObjectRecordType objectRecordType : response.getData()) {
                      System.out.println("Object Type");
                      System.out.println("Name = " + objectRecordType.getName());
                      System.out.println("Object = " + objectRecordType.getObject());
                      System.out.println("Active = " + objectRecordType.getActive());
                      System.out.println("Label = " + objectRecordType.getLabel());
                      for (ObjectRecordType.ObjectRecordTypeField field : objectRecordType.getTypeFields()) {
                              System.out.println("Field");
                              System.out.println("Name = " + field.getName());
                      }
       }
       
    • retrieveDetailsFromASpecificObject

      public ObjectRecordTypeResponse retrieveDetailsFromASpecificObject(String objectName, String objectType)
      Object Types - Retrieve Details from a Specific Object

      List all object types and all fields configured on each object type for the specific object. Note that an array is returned with size one.

      Parameters:
      objectName - The object name
      objectType - The object type name
      Returns:
      Describe of the single object, which will be the first element in the array
      Vault API Endpoint:
       GET /api/{version}/configuration/Objecttype.{object_name}.{object_type}
      Vault API Help Link:
      https://developer.veevavault.com/api/25.1/#retrieve-details-from-a-specific-object
      Example Request:
       ObjectRecordTypeResponse resp = vaultClient.newRequest(ObjectRecordRequest.class)
                      .retrieveDetailsFromASpecificObject(objectName, objectType);
      Example Response:
       System.out.println("Name = " + response.getData().getName());
       System.out.println("Object = " + response.getData().getObject());
       System.out.println("Active = " + response.getData().getActive());
       System.out.println("Label = " + response.getData().getLabel());
       for (ObjectRecordType.ObjectRecordTypeField field : response.getData().getTypeFields()) {
                      System.out.println("Field");
                      System.out.println("Name = " + field.getName());
       }
       
    • changeObjectType

      public ObjectRecordBulkResponse changeObjectType(String objectName)
      Object Types - Change Object Type

      Change the object type for the data supplied in localfile, binarydata, or raw json

      Parameters:
      objectName - The object name
      Returns:
      ObjectRecordBulkResponse
      Vault API Endpoint:
       POST /api/{version}/vobjects/{object_name}/actions/changetype
      Vault API Help Link:
      https://developer.veevavault.com/api/25.1/#change-object-type
      Example Request:
       VaultResponse resp = vaultClient.newRequest(ObjectRecordRequest.class)
                                              .setContentTypeCsv()
                                              .setBinaryFile("file",mapper.writeValueAsBytes(objectRecords))
                                              .changeObjectType(objectName);
      Example Response:
       System.out.println(resp.getResponse());
    • retrieveObjectRecordRoles

      public ObjectRecordRoleResponse retrieveObjectRecordRoles(String objectName, String id)
      Object Roles - Retrieve Object Record Roles

      Retrieve manually assigned roles on an object record and the users and groups assigned to them.

      Parameters:
      objectName - The object name
      id - The id of the object record
      Returns:
      ObjectRecordRoleResponse
      Vault API Endpoint:
       GET /api/{version}/vobjects/{object_name}/{id}/roles
      Vault API Help Link:
      https://developer.veevavault.com/api/25.1/#retrieve-object-record-roles
      Example Request:
       ObjectRecordRoleResponse resp = vaultClient.newRequest(ObjectRecordRequest.class)
                                      .retrieveObjectRecordRoles(objectName, id);
      Example Response:
       for (ObjectRole role : resp.getData()) {
         System.out.println("\nRole: " + role.getName() + ", Assignment Type = " + role.getAssignmentType());
      
         for (Integer i : role.getGroups())
         System.out.println("Group = " + i);
      
         for (Integer i : role.getUsers())
         System.out.println("User = " + i);
       }
    • retrieveObjectRecordRole

      public ObjectRecordRoleResponse retrieveObjectRecordRole(String objectName, String id, String roleName)
      Object Roles - Retrieve Object Record Role (Filter to a specific role)

      Retrieve manually assigned role on an object record and the users and groups assigned to them.

      Parameters:
      objectName - The object name
      id - The id of the object record
      roleName - Role name to filter for a specific role. For example, owner__v.
      Returns:
      ObjectRecordRoleResponse
      Vault API Endpoint:
       GET /api/{version}/vobjects/{object_name}/{id}/roles{/role_name}
      Vault API Help Link:
      https://developer.veevavault.com/api/25.1/#retrieve-object-record-roles
      Example Request:
       ObjectRecordRoleResponse resp = vaultClient.newRequest(ObjectRecordRequest.class)
                                      .retrieveObjectRecordRole(objectName, id, roleName);
      Example Response:
       for (ObjectRole role : resp.getData()) {
         System.out.println("\n" + role.getName() + ", Assignment Type = " + role.getAssignmentType());
      
         for (Integer i : role.getGroups()) {
           System.out.println("Group = " + i);
         }
      
         for (Integer i : role.getUsers()) {
           System.out.println("User = " + i);
         }
       }
    • assignUsersAndGroupsToRolesOnObjectRecords

      public ObjectRecordRoleChangeResponse assignUsersAndGroupsToRolesOnObjectRecords(String objectName)
      Object Roles - Assign Users and Groups to Roles on Object Records

      Assign users and groups to roles on an object record in bulk.

      Parameters:
      objectName - The name of the object where you want to update records.
      Returns:
      ObjectRecordRoleChangeResponse
      Vault API Endpoint:
       POST /api/{version}/vobjects/{object_name}/roles
      Vault API Help Link:
      https://developer.veevavault.com/api/25.1/#assign-users-amp-groups-to-roles-on-object-records
      Example Response:
       Example 1 - CSV
       ObjectRecordRoleChangeResponse resp = vaultClient.newRequest(ObjectRecordRequest.class)
                              .setInputPath(inputPath)
                              .setContentTypeCsv()
                              .assignUsersAndGroupsToRolesOnObjectRecords(objectName);
      ,
       Example 2 - JSON
       ObjectRecordRoleChangeResponse resp = vaultClient.newRequest(ObjectRecordRequest.class)
                              .setRequestString(requestString)
                              .setContentTypeJson()
                              .assignUsersAndGroupsToRolesOnObjectRecords(objectName);
      ,
       for (ObjectRecordRoleChangeResponse.ObjectRoleChange roleChange : resp.getData())
         System.out.println(roleChange.getResponseStatus() + " for " + roleChange.getData().getId());
       
    • removeUsersAndGroupsFromRolesOnObjectRecords

      public ObjectRecordRoleChangeResponse removeUsersAndGroupsFromRolesOnObjectRecords(String objectName)
      Object Roles - Remove Users and Groups from Roles on Object Records
      Parameters:
      objectName - The name of the object where you want to remove roles.
      Returns:
      ObjectRecordRoleChangeResponse
      Vault API Endpoint:
       DELETE /api/{version}/vobjects/{object_name}/roles
      Vault API Help Link:
      https://developer.veevavault.com/api/25.1/#remove-users-amp-groups-from-roles-on-object-records
      Example Request:
       Example 1 - CSV
       ObjectRecordRoleChangeResponse resp = vaultClient.newRequest(ObjectRecordRequest.class)
                              .setInputPath(inputPath)
                              .setContentTypeCsv()
                              .removeUsersAndGroupsFromRolesOnObjectRecords(objectName);
      ,
       Example 2 - JSON
       ObjectRecordRoleChangeResponse resp = vaultClient.newRequest(ObjectRecordRequest.class)
                              .setRequestString(requestString)
                              .setContentTypeJson()
                              .removeUsersAndGroupsFromRolesOnObjectRecords(objectName);
      Example Response:
       for (ObjectRecordRoleChangeResponse.ObjectRoleChange roleChange : resp.getData())
         System.out.println(roleChange.getResponseStatus() + " for " + roleChange.getData().getId());
    • deepCopyObjectRecord

      public JobCreateResponse deepCopyObjectRecord(String objectName, String recordId)
      Deep Copy Object Record

      Deep Copy copies an object record, including all of the record's related child and grandchild records. Each deep (hierarchical) copy can copy a maximum of 10,000 related records at a time.

      Add raw JSON request string for overriding/ignoring field values in the request by calling the "setRequestString" in the builder.

      Parameters:
      objectName - The name of the parent object to copy
      recordId - The ID of the specific object record to copy
      Returns:
      JobCreateResponse, with the job id of the created response
      Vault API Endpoint:
       POST /api/{version}/vobjects/{object_name}/{object_record_ID}/actions/deepcopy
      Vault API Help Link:
      https://developer.veevavault.com/api/25.1/#deep-copy-object-record
      Example Request:
       JobCreateResponse resp = vaultClient.newRequest(ObjectRecordRequest.class)
                                      .deepCopyObjectRecord(objectName, objectRecordId);
      Example Response:
       System.out.println("Status = " + resp.getResponseStatus());
      
       if (resp.isSuccessful()) {
         Integer jobId = resp.getJobId();
         System.out.println("Job id = " + jobId.toString());
      
         boolean jobRunning = true;
         while (jobRunning) {
           try {
             Thread.sleep(5000);
      
             JobStatusResponse respJob = vaultClient.newRequest(JobRequest.class).retrieveJobStatus(jobId);
             String status = respJob.getData().getStatus();
             System.out.println("Job status = " + status);
             if (status.equalsIgnoreCase("ERRORS_ENCOUNTERED")) {
               jobRunning = false;
      
               VaultResponse respJobResults = vaultClient.newRequest(ObjectRecordRequest.class).getResultsOfDeepCopyJob(objectName, false, jobId);
               System.out.println(new String(respJobResults.getBinaryContent()));
               }
             if (status.equalsIgnoreCase("SUCCESS")) {
               jobRunning = false;
      
               VaultResponse respJobResults = vaultClient.newRequest(ObjectRecordRequest.class).getResultsOfDeepCopyJob(objectName, true, jobId);
               System.out.println(new String(respJobResults.getBinaryContent()));
               }
      
      
             } catch (InterruptedException e) {
             e.printStackTrace();
             }
           }
         }
       }
    • getResultsOfDeepCopyJob

      public VaultResponse getResultsOfDeepCopyJob(String objectName, boolean success, int jobId)
      Get Results of Deep Copy Job

      Query vault to determine the results of the deep copy request.

      Parameters:
      objectName - The name of the deep copied object
      success - True for successes, false for failures
      jobId - The ID of the job, retrieved from the response of the job request.
      Returns:
      VaultResponse, with content retrieve via "getBinaryContent" method
      Vault API Endpoint:
       GET /api/{version}/vobjects/deepcopy/results/{object_name}/{job_status}/{job_id}
      Vault API Help Link:
      https://developer.veevavault.com/api/25.1/#get-results-of-deep-copy-job
      Example Request:
       See deepCopyObjectRecord(String, String)
    • retrieveDeletedObjectRecordId

      public ObjectRecordDeletedResponse retrieveDeletedObjectRecordId(String objectName)
      Retrieve Deleted Object Record ID

      Retrieve the IDs of object records that have been deleted from your vault within the past 30 days. The method automatically paginates to return all records in the response.

      • Optionally set start/end date ranges via the "setStartDateDeleted" and "setEndDateDeleted" methods. This also applies to the ""offset" and "limit" query parameters.
      • Note that only JSON responses are supported at this time
      • Calling code must write to CSV if CSV is needed
      Parameters:
      objectName - Object name for the recycle bin
      Returns:
      The recycle bin for deleted records, which can be retrieved via the "getDeleteRecords" method in the response
      Vault API Endpoint:
       GET /api/{version}/objects/deletions/vobjects/{object_name}
      Vault API Help Link:
      https://developer.veevavault.com/api/25.1/#retrieve-deleted-object-record-id
      Example Request:
       ObjectRecordDeletedResponse resp = vaultClient.newRequest(ObjectRecordRequest.class)
                                      .setStartDateDeleted(startDate)
                                      .setEndDateDeleted(endDate)
                                  .set
                                      .retrieveDeletedObjectRecordId(objectName);
      Example Response:
       if (resp.getData() != null) {
         System.out.println("Total Deleted Records = " + resp.getData().size());
         System.out.println("First record deleted " + resp.getData().get(0).getId() + ", " + resp.getData().get(0).getDateDeleted());
       }
       else
         System.out.println("No deleted records");
    • retrieveDeletedObjectRecordIdByPage

      public ObjectRecordDeletedResponse retrieveDeletedObjectRecordIdByPage(String pageUrl)
      Retrieve Deleted Object Record ID (By Page)

      Retrieve the IDs of object records using the previous_page or next_page parameter of a previous request

      Parameters:
      pageUrl - The URL from the previous_page or next_page parameter
      Returns:
      The recycle bin for deleted records, which can be retrieved via the "getData" method in the response
      Vault API Endpoint:
       GET /api/{version}/objects/deletions/vobjects/{object_name}
      Vault API Help Link:
      https://developer.veevavault.com/api/25.1/#retrieve-deleted-object-record-id
      Example Request:
       ObjectRecordDeletedResponse paginatedResponse = vaultClient.newRequest(ObjectRecordRequest.class)
                      .retrieveDeletedObjectRecordIdByPage(response.getResponseDetails().getNextPage());
      Example Response:
      System.out.println(paginatedResponse.getResponseStatus())
      ;
    • retrieveLimitsOnObjects

      public VaultResponse retrieveLimitsOnObjects()
      Retrieve Limits on Objects
      Returns:
      VaultResponse - get raw string (no response model)
      Vault API Endpoint:
       GET /api/{version}/limits
      Vault API Help Link:
      https://developer.veevavault.com/api/25.1/#retrieve-limits-on-objects
    • updateCorporateCurrencyFields

      public JobCreateResponse updateCorporateCurrencyFields(String objectName)
      Update Corporate Currency Fields

      Add raw JSON request string for overriding/ignoring field values in the request by calling the "setRequestString" in the builder.

      Parameters:
      objectName - The object name__v field value, for example, product__v
      Returns:
      JobCreateResponse, with the job id of the created response
      Vault API Endpoint:
       PUT /api/{version}/vobjects/{object_name}/actions/updatecorporatecurrency
      Vault API Help Link:
      https://developer.veevavault.com/api/25.1/#update-corporate-currency-fields
    • initiateRecordMerge

      public ObjectRecordMergeJobResponse initiateRecordMerge(String objectName)
      Initiate Record Merge

      Initiate a record merge operation in bulk. Starts a record merge job. When merging two records together, you must select one record to be the main_record_id and one record to be the duplicate_record_id.

      Add raw JSON request string by calling the "setRequestString" in the builder.

      Parameters:
      objectName - The object name for the records being merged
      Returns:
      ObjectRecordMergeJobResponse
      Vault API Endpoint:
       POST /api/{version}/vobjects/{object_name}/actions/merge
      Vault API Help Link:
      https://developer.veevavault.com/api/25.1/#initiate-record-merge
      Example Request:
       Example 1 - CSV input
       ObjectRecordMergeJobResponse response = vaultClient.newRequest(ObjectRecordRequest.class)
                      .setContentTypeCsv()
                      .setInputPath(csvPath)
                      .initiateRecordMerge(objectName);
      
       Example 2 - JSON input
       ObjectRecordMergeJobResponse response = vaultClient.newRequest(ObjectRecordRequest.class)
                      .setContentTypeJson()
                      .setRequestString(jsonRequestString)
                      .initiateRecordMerge(objectName);
      
       Example 3 - Binary input
       ObjectRecordMergeJobResponse response = vaultClient.newRequest(ObjectRecordRequest.class)
                      .setContentTypeCsv()
                      .setBinaryFile(csvFile.getName(), csvBytes)
                      .initiateRecordMerge(objectName);
       
      Example Response:
       Integer jobId = response.getData().getJobId();
       
    • retrieveRecordMergeStatus

      public JobStatusResponse retrieveRecordMergeStatus(int jobId)
      Retrieve Record Merge Status

      Given a job_id for a merge records job, retrieve the job status.

      Before submitting this request:

      1. You must have previously requested a record merge job
      2. You must have a valid job_id field value returned from the record merge operation
      Parameters:
      jobId - The job id field value returned from the merge operation.
      Returns:
      JobStatusResponse
      Vault API Endpoint:
       GET /api/{version}/vobjects/merges/{job_id}/status
      Vault API Help Link:
      https://developer.veevavault.com/api/25.1/#retrieve-record-merge-status
      Example Request:
       JobStatusResponse response = vaultClient.newRequest(ObjectRecordRequest.class)
                      .retrieveRecordMergeStatus(jobId);
       
      Example Response:
       System.out.println("Job Status: " + response.getData().getStatus());
       
    • retrieveRecordMergeResults

      public ObjectRecordMergeResultsResponse retrieveRecordMergeResults(int jobId)
      Retrieve Record Merge Results

      Given a job_id for a merge records job, retrieve the job results.

      Before submitting this request:

      1. You must have previously requested a record merge job which is no longer in progress
      2. You must have a valid job_id field value returned from the record merge operation
      Parameters:
      jobId - The job id field value returned from the merge operation.
      Returns:
      JobStatusResponse
      Vault API Endpoint:
       GET /api/{version}/vobjects/merges/{job_id}/results
      Vault API Help Link:
      https://developer.veevavault.com/api/25.1/#retrieve-record-merge-results
      Example Request:
       ObjectRecordMergeResultsResponse response = vaultClient.newRequest(ObjectRecordRequest.class)
                      .retrieveRecordMergeResults(jobId);
       
      Example Response:
       for (MergeSet mergeSet : response.getData().getMergeSets()) {
                      System.out.println("-------------------------------");
                      System.out.println("Duplicate Record ID: " + mergeSet.getDuplicateRecordId());
                      System.out.println("Main Record ID: " + mergeSet.getMainRecordId());
                      System.out.println("Status: " + mergeSet.getStatus());
                      System.out.println("-------------------------------");
       }
       
    • setAcceptCSV

      public ObjectRecordRequest setAcceptCSV()
      Set the Header Accept to return CSV
      Returns:
      The Request
    • setBinaryFile

      public ObjectRecordRequest setBinaryFile(String filename, byte[] binaryContent)
      Specify source data in an input file
      Parameters:
      filename - file name (no path)
      binaryContent - byte array of the file content
      Returns:
      The Request
    • setBodyParams

      public ObjectRecordRequest setBodyParams(Map<String,Object> bodyParams)
      Single record form ObjectRecordRequest with name/value body parameters
      Parameters:
      bodyParams - map of body params
      Returns:
      The Request
    • setContentTypeCsv

      public ObjectRecordRequest setContentTypeCsv()
      Set the Header Content Type to CSV
      Returns:
      The Request
    • setContentTypeJson

      public ObjectRecordRequest setContentTypeJson()
      Set the Header Content Type to JSON
      Returns:
      The Request
    • setEndDateDeleted

      public ObjectRecordRequest setEndDateDeleted(ZonedDateTime endDateDeleted)
      Specify the start date when calling the deleted records endpoint

      Specify a date (no more than 30 days past) after which Vault will look for deleted object records. Dates and times are in UTC. If the time is not specified, it will default to midnight (T00:00:00Z) on the specified date. Date formats will automatically be formatted.

      Parameters:
      endDateDeleted - End date for the date range
      Returns:
      The Request
    • setIdParam

      public ObjectRecordRequest setIdParam(String idParam)
      Specify an UPSERT operation via the idParam
      Parameters:
      idParam - External Id field API name for the UPSERT
      Returns:
      The Request
    • setLocalized

      public ObjectRecordRequest setLocalized(Boolean localized)
      Set to true to retrieve localized (translated) strings for the label, label_plural, and help_content object type fields.
      Parameters:
      localized - True for localized strings
      Returns:
      The request
    • setInputPath

      public ObjectRecordRequest setInputPath(String inputPath)
      Specify source data in an input file
      Parameters:
      inputPath - Absolute path to the file for the request
      Returns:
      The Request
    • setMigrationMode

      public ObjectRecordRequest setMigrationMode(boolean migrationMode)
      Enable migration mode to set the object record state. If not specified, records will be created in their initial state. API user must have the Record Migration permission to use this header.
      Parameters:
      migrationMode - The source request as a string
      Returns:
      The Request
    • setNoTriggers

      public ObjectRecordRequest setNoTriggers(boolean noTriggers)
      When set to true, it bypasses all system, standard, and custom triggers when using Record Migration Mode. API user must have the Record Migration permission to use this header.
      Parameters:
      noTriggers - Boolean value to bypass triggers
      Returns:
      The Request
    • setOutputPath

      public ObjectRecordRequest setOutputPath(String outputPath)
      Specify source data in an output file
      Parameters:
      outputPath - Absolute path to the file for the response
      Returns:
      The Request
    • setRequestString

      public ObjectRecordRequest setRequestString(String requestString)
      Specify source data in an input string, such as a JSON request
      Parameters:
      requestString - The source request as a string
      Returns:
      The Request
    • setInputStream

      public ObjectRecordRequest setInputStream(InputStream inputStream)
      Specify source data in an input stream, such as a JSON request
      Parameters:
      inputStream - The source data as an input stream
      Returns:
      The Request
    • setStartDateDeleted

      public ObjectRecordRequest setStartDateDeleted(ZonedDateTime startDateDeleted)
      Specify the start date when calling the deleted records endpoint

      Specify a date (no more than 30 days past) after which Vault will look for deleted object records. Dates and times are in UTC. If the time is not specified, it will default to midnight (T00:00:00Z) on the specified date. Date formats will automatically be formatted.

      Parameters:
      startDateDeleted - Start date for the date range
      Returns:
      The Request
    • setUnchangedFieldBehavior

      public ObjectRecordRequest setUnchangedFieldBehavior(ObjectRecordRequest.UnchangedFieldBehaviorType unchangedFieldBehavior)
      When upserting, set to IgnoreSetOnCreateOnly (default starting with API v21.1) to ignore values given for the Object Type field and parent object fields if the record already exists and the value has not changed. Set to NeverIgnore to enforce edit permission for all fields in the payload, regardless of whether or not the value has changed. Read-only fields such as Object Type will fail even if the value has not changed. Set to AlwaysIgnore to ignore fields that match between the record and payload values during upsert.
      Parameters:
      unchangedFieldBehavior - The source request as a string
      Returns:
      The Request
    • setOffset

      public ObjectRecordRequest setOffset(Integer offset)
      Paginate the results displayed per page by specifying the amount of offset from the first job history returned. If omitted, defaults to 0.
      Parameters:
      offset - page offset
      Returns:
      The Request
    • setLimit

      public ObjectRecordRequest setLimit(Integer limit)
      Paginate the results by specifying the maximum number of histories per page in the response. This can be any value between 1 and 200. If omitted, defaults to 50.

      Parameters:
      limit - the size of the result set in the page
      Returns:
      The request