AnsweredAssumed Answered

variable set in the bean but not available outside bean

Question asked by kethur on Nov 16, 2012
Latest reply on Nov 16, 2012 by jbarrez
Hi Team,

I have a user task :
      <userTask id="usertaskApproval" name="Approval">
        <extensionElements>
          <activiti:taskListener expression="${documentTaskCreateListener.notify(task, execution)}" event="create" />
          <activiti:taskListener expression="${documentTaskCompleteListener.notify(task, execution)}" event="complete" />
        </extensionElements>
      </userTask>

in the bean i am trying to set the variable so that i can access the variable elsewhere.  But it gives me an exception saying… execution id not found.

        //This is not working - throws exception.
        runtimeService.setVariable(execution.getId(), WorkflowConstants.DOCUMENT_QUEUES_VAR_NAME, documentQueuesMap);

        //This does not throw exception but the value i set is not available outside.  its the same old value.
        delegateTask.setVariable(WorkflowConstants.DOCUMENT_QUEUES_VAR_NAME, documentQueuesMap);


Exception:

   at org.activiti.engine.impl.delegate.DefaultDelegateInterceptor.handleInvocation(DefaultDelegateInterceptor.java:25)
   at org.activiti.engine.impl.el.JuelExpression.getValue(JuelExpression.java:50)
   … 214 more
Caused by: [color=#FF0000]org.activiti.engine.ActivitiException: execution 115 doesn't exist[/color]
   at org.activiti.engine.impl.cmd.SetExecutionVariablesCmd.execute(SetExecutionVariablesCmd.java:50)
   at org.activiti.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
   at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:42)
   at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
   at org.activiti.engine.impl.RuntimeServiceImpl.setVariable(RuntimeServiceImpl.java:116)
   at com.xxxx.xxxx.xx.workflow.activiti.business.impl.document.listener.DocumentTaskListener.setNewStateInQueuesProcessVariable(DocumentTaskListener.java:52)
   at com.xx.xx.h2ng.workflow.activiti.business.impl.document.listener.DocumentTaskCreateListener.notify(DocumentTaskCreateListener.java:17)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.activiti.engine.impl.javax.el.BeanELResolver.invoke(BeanELResolver.java:479)
   … 224 more

Outcomes