How to pass StartedByUser from parent process to subprocess using call activity

I am using a Call Activity in a process and when the child process gets created the Started By User is null. Is it possible to pass the Starter from parent to child process?

Hi,

we actually had a similar use case and came up with the solution where we extend the existing org.activiti.engine.impl.bpmn.behavior.CallActivityBehavior.

There we have overridden the execute method in the way similar to following:

@Override
public void execute(DelegateExecution execution) {
    String originalUserId = Authentication.getAuthenticatedUserId();

    try {
        Authentication.setAuthenticatedUserId(getUserToPropagate(execution));
        super.execute(execution);
    } finally {
        Authentication.setAuthenticatedUserId(originalUserId);
    }
}

private String getUserToPropagate(DelegateExecution execution) {
         HistoricProcessInstanceEntity historicProcessInstanceEntity = CommandContextUtil.getHistoricProcessInstanceEntityManager()
            .findById(execution.getProcessInstanceId());
         return historicProcessInstanceEntity.getStartUserId();
}

Thanks for response Vasil, This will change the behavior of call activity and will have impact in all call activity. But I wanted to do this in specific workflow process. For now I fixed it by adding a new variable “startedById” to main process and passed it to child process. It is working, although I don’t like it.