Get Document version id from documentService.createDocuments
AnsweredAfter trying to create document placeholder from campaign object as Record action
using below code then I am trying to update document Owner Role but I am unable to get document versionId.. though I am getting it as String but I want it as DocumentVersion. How can I get that?
SaveDocumentVersionsResponse documents =
documentService.createDocuments(VaultCollections.asList(r));
String documentVersionId = documents.getSuccesses().get(0).getDocumentVersionId();
DocumentRoleService docRoleService = ServiceLocator.locate(DocumentRoleService.class);
String ROLE_TO_CHECK = "owner__v";
DocumentRoleUpdate docRoleUpdate = docRoleService.newDocumentRoleUpdate(ROLE_TO_CHECK, documentVersionId);
// documentversion id is string but it should be of Type DocumentVerison How to get that?
docRoleUpdate.addUsers(VaultCollections.asList(docOnwerId));
//Add up to 500 role updates in a single batch
docRoleService.batchUpdateDocumentRoles(VaultCollections.asList(docRoleUpdate))
.rollbackOnErrors()
.execute();
0
-
Official comment
Hi Manish,
You can use the documentVersionId string to use the DocumentService#newVersionWithId.
https://repo.veevavault.com/javadoc/vault-sdk-api/22.1.0/docs/api/com/veeva/vault/sdk/api/document/DocumentService.html#newVersionWithId-java.lang.String-This method creates a new interface of an existing document version for you to interact within SDK.
Please sign in to leave a comment.
Comments
1 comment