Skip to content

Duplicate records in Vault can happen due to migrations, integrations, or day-to-day activities and may be difficult to resolve. Vault provides a solution to duplicate records by allowing you to merge two records together. You can only initiate record merges through Vault API or the Vault Java SDK, and you cannot initiate a record merge through the Vault UI.

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. The merging process updates all inbound references (including attachments) from other objects that point to the duplicate record and moves those over to the main record. Field values on the main record are not changed, and when the process is complete, the duplicate record is deleted.

The following example uses RecordService to execute two record merges within the account__v object:

LogService logService = ServiceLocator.locate(LogService.class); RecordService recordService = ServiceLocator.locate(RecordService.class); RecordMergeSetInput recordMergeSetInput1 = recordService.newRecordMergeSetInputBuilder() .withDuplicateRecordId("V6G000000001005") .withMainRecordId("V6G000000001002") .build(); RecordMergeSetInput recordMergeSetInput2 = recordService.newRecordMergeSetInputBuilder() .withDuplicateRecordId("V6G000000006002") .withMainRecordId("V6G000000001002") .build(); RecordMergeRequest request = recordService.newRecordMergeRequestBuilder() .withObjectName("account__v") .withRecordMerges(VaultCollections.asList(recordMergeSetInput1, recordMergeSetInput2)) .build(); recordService.mergeRecords(request) .onSuccess(success -> { String jobId = success.getJobId(); logService.info(String.format("Successfully started merge with job [%s]", jobId)); }) .onError(recordMergeOperationError -> { recordMergeOperationError.getErrors().forEach(error -> { String errorMessage = error.getError().getMessage(); RecordMergeOperationErrorType errorType = error.getErrorType(); if (errorType.equals(RecordMergeOperationErrorType.INVALID_DATA)) { logService.info(String.format("Failed to start merge due to INVALID_DATA. Error: [%s]", errorMessage)); } else if (errorType.equals(RecordMergeOperationErrorType.OPERATION_NOT_ALLOWED)) { logService.info(String.format("Failed to start merge due to OPERATION_NOT_ALLOWED. Error: [%s]", errorMessage)); } }); }) .execute();

Learn more about executing record merges with the Vault Java SDK in the Javadocs.

Before you can execute a record merge, your Vault must be correctly configured. For example, the Vault object must have merges enabled and the initiating user must have permission to execute merges. Learn more about the configuration required for record merges in Vault Help.

  • Record merges do not trigger record triggers
  • You can merge two (2) records in a single RecordMergeSetInput, one main and one duplicate record
  • You can merge up to 10 RecordMergeSetInputs in a single request
  • In a single request, you can merge multiple duplicate records into the same main record, but you cannot merge the same duplicate record into more than one main record