Updating a BPROC process variable directly from a service in the core

I´d like to know how to update a process variable from a SERVICE in the CORE

        //TODO UPDATE PROCESS FORM FROM CORE ::
    ProcessInstanceDataQuery processInstanceDataQuery = bprocRuntimeService.createProcessInstanceDataQuery();
    ProcessInstanceData processInstanceData = processInstanceDataQuery.processInstanceId(processInstanceId).singleResult();
    processInstanceData // I WANT TO UPDATE A PROCESS FORM VARIABLE FROM HERE
    /*processInstanceData.process
    bprocRuntimeService.process*/

I would also like to know how to send the processInstanceId from the modeler to a service task.

also, is this the best way to get the current process instance data of the current form?

ProcessInstanceData processInstanceData = bprocRuntimeService.createProcessInstanceDataQuery()
            .processInstanceId(processFormContext.getTaskData()
                    .getProcessInstanceId()).singleResult();

I´d like to know how to update a process variable from a SERVICE in the CORE

Take a look at the setVariable method in the BprocRuntimeService: com.haulmont.addon.bproc.service.BprocRuntimeService#setVariable

I would also like to know how to send the processInstanceId from the modeler to a service task.

Your service method may have a string parameter called executionId. When you define an expression for the service method parameter value in the modeler, pass the execution.id there and check the “is var” checkbox.

also, is this the best way to get the current process instance data of the current form

yes

1 Like

Thank you this was what we were looking for!