How to set a var locally in event subprocess

hi all.
I have a event subprocess, it will trige multi times in one proc_ins.
and a var_a need to set in task1, and then read in task2.

1st try:
i tried by execution local first runtimeService.setVariablesLocal(task1.getExecutionId(), localExeAddVars);
but find the task1 and task2 is in different executionid. task2’s executionId is same with the subproc.

2nd try:
tried with end listerner, to set to parent scope:
execution.setVariable("var_a", "aaaaa", execution.getParentActivityInstanceId());
throw error:

Scope with specified activity Id Activity_061a6o4:31688 and execution 31690 not found

how to resolve?

Try it with execution.getParentId() instead of execution.getParentActivityInstanceId().

Did you try in the end listener
execution.setVariableLocal('varname', 'varvalue')
I haven’t needed to specify the execution Id before when setting variables a event subprocess before.

I think the two executions result from the fact that there is a boundary event.