3 Replies Latest reply on Aug 26, 2014 2:07 PM by Samrat Roy

    Set ProcessVariables on a running processInstance over RemoteAPI -jBPM 6.0.1

    Samrat Roy Newbie

      Hi ,

      Apart from supplying processVariables when begining a process ,we used to be able to set process variables for  processInstances which is already running using the GenericCommands like :

       

      Map<String, Object> variables = ksession.execute(new GenericCommand<Map<String, Object>>() {
          public Map<String, Object> execute(Context context) {
              KieSession ksession = ((KnowledgeCommandContext) context).getStatefulKnowledgesession();
              org.jbpm.process.instance.ProcessInstance processInstance = (org.jbpm.process.instance.ProcessInstance) ksession.getProcessInstance(piId);
              VariableScopeInstance variableScope = (VariableScopeInstance) processInstance.getContextInstance(VariableScope.VARIABLE_SCOPE);
              Map<String, Object> variables = variableScope.getVariables();
              return variables;
          }
      });
      

       

      How do we do the same when using RemoteAPI over REST ? I checked the REST calls in the documentation but I didn't find any for setting variables in processInstances which are already running.

       

      If I use the above mentioned code , I get the exception :

      java.lang.UnsupportedOperationException: The .execute(..) method is not supported on the remote api.

       

      salaboy21 can you help ?