Skip navigation links

Package com.veeva.vault.sdk.api.job

This package provides interfaces to execute asynchronous jobs.

See: Description

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

This package provides interfaces to execute asynchronous jobs.

Change State

The following illustrates running a job to invoke a lifecycle user action to change state:
     
     //Get an instance of job for invoking user actions
     JobService jobService = ServiceLocator.locate(JobService.class);
     JobParameters jobParameters = jobService.newJobParameters("record_user_action__v");

     //Run job to invoke user action to change state
     jobParameters.setValue("user_action_name", "change_state_to_in_use_useraction__c");
     jobParameters.setValue("records", records);
     jobService.run(jobParameters);
     
 
The user_action_name parameter value, change_state_to_in_use_useraction__c, is from the configured lifecycle. It is derived by taking the lifecycle user action label in lower case, replacing any spaces with underscore, and appending _useraction__c.

The records parameter specifies the set of records to change state.

Start Workflow

The following illustrates running a job to invoke a lifecycle user action to start a workflow.
     
     //Get an instance of job for invoking user actions
     JobService jobService = ServiceLocator.locate(JobService.class);
     JobParameters jobParameters = jobService.newJobParameters("record_user_action__v");

     //Run job to invoke user action to start workflow
     jobParameters.setValue("user_action_name", "evaluate_country_brand_useraction__c");
     jobParameters.setValue("records", records);
     jobParameters.setValue("review_date__c", LocalDate.now().plusMonths(1));
     jobService.run(jobParameters);
     
 
The user_action-name parameter value, e.g. "evaluate_country_brand_useraction__c", is from the configured lifecycle. It is derived by taking the lifecycle user action label in lower case, replacing any spaces with underscore, and appending _useraction__c. Note that your vault may name actions differently. To get the names of actions in your vault, Retrieve Object Record User Actions with the Vault REST API.

The records parameter specifies the set of records to start the workflow.

If a workflow has start options containing Date control, such as review_date__c, it can be set to a value when starting the workflow. This is the only input control supported at this time. Learn more about start step controls in Vault Help.

You can only start workflows with Participants control set to Add participants from roles in Sharing Settings. This allows dynamic participant assignment based on roles. Learn more in Vault Help.

Skip navigation links

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