Skip navigation links

Package com.veeva.vault.sdk.api.document

This package provides interfaces to manage documents and binders.

See: Description

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

This package provides interfaces to manage documents and binders. The interfaces in this package allow you to: Use 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);
 
 
Skip navigation links

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