Update case context

Hi,

There's an api call to retrieve the context business data references of a given caseId. but is there any way to update the business data references of a given caseid using direct API calls or using groovy?

Thank you

Hi,

All BDM write operations (create/update/delete) must be executed in a process (using an activity operation by example).

HTH
Romain

Hi romain.bioteau,
Thank you very much for your response.

The image; https://drive.google.com/file/d/16OFa0m7-NTVwcPglhhSnyH8QFW70sI03/view?usp=sharing is defining my scenario. 

There are parent process and 2 child processes. Assume that several business variables are defined in the Parent Pool context.

  • business variables - applications - java.util.List(com.company.model.Application)

Prior to calling the subprocesses & after calling the subprocesses, the Parent Pool is adding values(new entity instances) to "applications" business variable. {I am sending applications ref values of Parent Pool to subprocesses using Data to send option on call activity task}

Inside the child processes(subprocess1 & subprocess2) also, adding several new entity instances of com.company.model.Application to the applications(defined on the subprocess context) business variable.

Can you please give me an idea about how to update the Parent Pool "applications" business variable without using Data to receive option in call activities?  Data to receive option in call activities executing when finishing the subprocesses. I want to update the business variable of the Parent Pool whenever values adding to the applications ref in the subprocesses context.

Note- apiAccessor.processAPI.updateProcessDataInstance(dataName, rootProcessInstanceId, dataValue) - for Process Variables
apiAccessor.processAPI.addDocument(rootProcessInstanceId, documentName, description, documentValue) - for Documents

???? - for business variables

If you want to add/remove elements in your application list you must use the Data to receive in call activity output otherwise removed/created instances in child processes will not be attached to the parent multiple variable.
If the child processes only modify existing application instances, you can pass the list of application persistenceId as contract input of the child processes and retrieve application instances in a applications business variables with a default value like this:

applicationIdsInput.collect{ applicationDao.findByPersistenceId(it) }

Here is an example using Data to receive, you can try to remove it and see that existing instances are modified properly, but new or deleted instances are not present in the parent variable.

HTH
Romain

Thank you very much for your answer.