Update the search key value of the root process

1
+1
-1

Hi,

Have you got an idea on how to update the search key value of the main process when the case is in a subprocess ?

Thanks a lot.

1 answer

1
0
-1
This one is the BEST answer!

Hi,

Diagram Design

Yes indeed, an operation associated to a task, part of a subprocess, only updates the stringindex (search key) value of the subprocess.

An operation part of a task in the parent process is needed, in order to update a search key's value of a parent process. One possibility would be to add an operation to the call activity that started the subprocess. When the subprocess returns, the operation associated to the call activity is executed and updates the search key's value.

Subscription Engine's API

The engine's ProcessAPI can be used from within a java connector, associated to the tasks in the subprocess, in order to update the values of the search keys of the parent processes, thanks to this below method, only available with the subscription version:

public ProcessInstance updateProcessInstanceIndex(long processInstanceId, Index index, String value)

Abstract:

    ...

    @Override
    protected void executeBusinessLogic() throws ConnectorException {
        final long rootProcessInstanceId = this.getExecutionContext().getRootProcessInstanceId();
       
        com.bonitasoft.engine.api.ProcessAPI processAPI = (com.bonitasoft.engine.api.ProcessAPI) this.getAPIAccessor().getProcessAPI();
        processAPI.updateProcessInstanceIndex(rootProcessInstanceId, Index.FIRST, "my new value");

    ...

Regards,
Jerome

Notifications