See: Description
Interface | Description |
---|---|
DeleteDocumentVersionsResponse |
Response from a call to
DocumentService.deleteDocumentVersions(List) (List)}. |
DocumentService |
Provides methods to update and delete documents.
|
DocumentVersion |
Represents a document version.
|
PositionalDocumentVersionId |
Represents a successful result of processing a document in a batch operation, such as a save or delete.
|
SaveDocumentVersionsResponse |
Response from a call to
DocumentService.saveDocumentVersions(List) . |
DocumentService
to create a DocumentVersion
object, which is an instance of an existing document. You can then update field values or delete the document.
After updating or deleting a DocumentVersion
, you need to execute a batch operation to commit the operation. For
example, after updating a document, you need to execute DocumentService.saveDocumentVersions(java.util.List)
(java.util.List)}
to save your changes.
In the following example, we update fields on the existing document ID 320, delete document ID 310, and delete a specific version of document ID 330.
DocumentService documentService = ServiceLocator.locate(DocumentService.class);
DocumentVersion documentVersion = documentService.newDocumentWithId("320");
LocalDateTime ldt = LocalDateTime.of(2016, Month.AUGUST, 22, 14, 30);
documentVersion.setValue("expiration_date__vs", LocalDate.now());
List languageList = VaultCollections.newList();
languageList.add("en_US");
documentVersion.setValue("language__v", languageList);
documentVersion.setValue("approved__c", Boolean.FALSE);
documentVersion.setValue("datetime__c", ldt.atZone(ZoneId.of("Asia/Kuala_Lumpur")));
DocumentVersion documentVersion2 = documentService.newDocumentWithId("310");
DocumentVersion documentVersion3 = documentService.newDocumentVersion("330_0_1");
List versionsToUpdate = VaultCollections.newList();
versionsToUpdate.add(documentVersion);
List versionsToDelete = VaultCollections.newList();
versionsToDelete.add(documentVersion2);
versionsToDelete.add(documentVersion3);
documentService.deleteDocumentVersions(versionsToDelete);
documentService.saveDocumentVersions(versionsToUpdate);
Copyright © Veeva Systems 2017–2018. All rights reserved.