0

Is there any State Change predefined method available in Veeva SDK

Hi All,

In Veeva API we have life cycle action available by which we can change state from one to another if next state is available in User action. Please refer to the API for your Reference :

/api/v20.1/objects/documents/" + version_id[0] + "/versions/" + version_id[1] + "/" + version_id[2] + "/lifecycle_actions

Is there any predefined state change method available in VSDK so that we can perform same activity without calling any API or httpcallout.

Thanks,
Sumit Saha

4 comments

  • Avatar
    Sameer Mehta Official comment

    Hi Sumit,

    You can use the job service to change state using a user action or an entry action. Here is an example of using a user action to 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);

    For more information on the job service, please refer to the SDK Java docs: https://repo.veevavault.com/javadoc/vault-sdk-api/20.1.3/docs/api/index.html

    Best Regards,

    Sameer Mehta

  • Avatar
    Sumit Saha

    Hi Sameer,

    Thank you for your response.

    but before going to change state there are some other processing activity which need to be fulfilled first.

    In my custom sdk code, I am triggering my code in Lifecycle entry action and after that I am processing some data , getting some ids and based on status of those ids, I am going to change state of those doc IDs. Therefore, before going to change state , there are other processing activity which need to fulfill first and those activity is happening when a document reaches one particular state ( Entry Action Trigger).

    Now my question is , Is there any predefined method available in Veeva sdk by which I can provide my all ids (which I got after processing some data) , as input and sdk method will change the state of my given IDs accordingly.

    Thanks,
    Sumit Saha

  • Avatar
    Sumit Saha

    Hi Sameer,

    To add one more point is that the above job service you provided, are they limited to only object lifecycle or it is also applicable in document lifecycle as I am working on to change state of multiple documents not records.

    Thanks,

    Sumit saha

  • Avatar
    Sameer Mehta

    Hi Sumit, 

    The job service is only used to execute jobs. You can use it to execute triggers, and actions on records and documents. There is no predefined method that will change the state of the document. To change the state of a document, you can use a Change State Lifecycle action. To use a change state lifecycle action, you must configure a user action. This user action can be executed using the job service.

    Hope that helps!

     

Please sign in to leave a comment.