Class DocumentWorkflowRequest

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

public class DocumentWorkflowRequest extends VaultRequest<DocumentWorkflowRequest>
The API allows you to retrieve, manage, and initiate document workflows.
Vault API Coverage:
https://developer.veevavault.com/api/25.1/#retrieve-all-document-workflows
  • Method Details

    • retrieveAllDocumentWorkflows

      public DocumentWorkflowResponse retrieveAllDocumentWorkflows()
      Retrieve All Document Workflows
      Retrieve all available document workflows that can be initiated on a set of documents
      Returns:
      DocumentWorkflowResponse
      Vault API Endpoint:
       GET /api/{version}/objects/documents/actions
      Vault API Help Link:
      https://developer.veevavault.com/api/25.1/#retrieve-all-document-workflows
      Example Request:
       DocumentWorkflowResponse resp = vaultClient.newRequest(DocumentWorkflowRequest.class)
                                      .retrieveAllDocumentWorkflows();
      Example Response:
       if (resp.getData() != null) {
         for (DocumentWorkflow workflow : resp.getData()) {
           System.out.println("------------------------------");
           System.out.println("Name " + workflow.getName());
           System.out.println("Label " + workflow.getLabel());
           System.out.println("Type " + workflow.getType());
           }
       }
    • retrieveDocumentWorkflowDetails

      public DocumentWorkflowDetailsResponse retrieveDocumentWorkflowDetails(String workflowName)
      Retrieve Document Workflow Details
      Retrieves the details for a specific document workflow.
      Parameters:
      workflowName - The document workflow name value. Obtained from the Retrieve All Document Workflows request retrieveAllDocumentWorkflows()
      Returns:
      DocumentWorkflowDetailsResponse
      Vault API Endpoint:
       GET /api/{version}/objects/documents/actions/{workflow_name}
      Vault API Help Link:
      https://developer.veevavault.com/api/25.1/#retrieve-document-workflow-details
      Example Request:
       DocumentWorkflowDetailsResponse resp = vaultClient.newRequest(DocumentWorkflowRequest.class)
                                      .retrieveDocumentWorkflowDetails(workflowName);
      Example Response:
       if (resp.getData() != null) {
         DocumentWorkflowDetailsResponse.DocumentWorkflow workflow = resp.getData();
         System.out.println("Workflow Name " + workflow.getName());
         System.out.println("------------------------------");
         for (Control con : workflow.getControls()) {
           System.out.println("Control Exist\n");
           System.out.println("------------------------------");
           System.out.println("Control Instruction " + con.getInstructions());
           System.out.println("Control Label " + con.getLabel());
           System.out.println("Control Type " + con.getType());
      
           for (Prompt prompts : con.getPrompts()) {
             System.out.println("\tPrompts Exist\n");
             System.out.println("------------------------------");
             System.out.println("\tPrompt Lable " + prompts.getLabel());
             System.out.println("\tPrompt Name " + prompts.getName());
             System.out.println("\tPrompt Multivalue " + prompts.getMultiValue());
      
           }
         }
       }
       
    • initiateDocumentWorkflow

      public InitiateDocumentWorkflowResponse initiateDocumentWorkflow(String workflowName, List<String> documents, Map<String,String> participantName, String description)
      Initiate Document Workflow
      Initiate a document workflow on a set of documents. If any document is not in the relevant state or does not meet configured field conditions, the API returns INVALID_DATA for the invalid documents and the workflow does not start.
      Parameters:
      workflowName - The document workflow name value. Obtained from the Retrieve All Document Workflows request retrieveAllDocumentWorkflows()
      documents - Input a comma-separated list of document id field values.
      participantName - Enter the participant name and input the user or group id value. For example, approvers__c: user:123,group:234.
      description - Description of the workflow. Maximum 1,000 characters.
      Returns:
      InitiateDocumentWorkflowResponse
      Vault API Endpoint:
       POST /api/{version}/objects/documents/actions/{workflow_name}
      Vault API Help Link:
      https://developer.veevavault.com/api/25.1/#initiate-document-workflow
      Example Request:
       InitiateDocumentWorkflowResponse resp = vaultClient.newRequest(DocumentWorkflowRequest.class)
                                                      .initiateDocumentWorkflow(workflowName, documents,participantName,description);
      Example Response:
       System.out.println("Status = " + resp.getResponseStatus());
      
       if (resp.isSuccessful()) {
         System.out.println("Record ID " + resp.getData().getRecordId());
         System.out.println("Record URL " + resp.getData().getRecordUrl());
         System.out.println("Workflow ID " + resp.getData().getWorkflowId());
       }
    • setLoc

      public DocumentWorkflowRequest setLoc(Boolean loc)
      When localized (translated) strings are available, retrieve them by setting loc to true
      Parameters:
      loc - Set to true to retrieve localized (translated) strings (if available)
      Returns:
      The request
    • setAcceptJSON

      public DocumentWorkflowRequest setAcceptJSON()
      Set the Header Accept to return JSON
      Returns:
      The Request