Hi, I am trying to set and unset an execution variable using process instance Id.
I save the process instance Id in database initially, and from a REST API , get the same instance Id to set and unset the variable.
My understanding is, that for a particular execution, the process instance Id remains same through out.
I set the variable as follows:
public static void setPauseVariable(String processInstanceId, boolean pause) throws Exception {
try {
HttpClient httpclient = HttpClientBuilder.create().build();
String uri = "http://localhost:8080/engine-rest/process-instance/" + processInstanceId + "/variables/pause";
HttpPut httpPut = new HttpPut(uri);
JSONObject requestJson = new JSONObject();
requestJson.put("value", pause);
requestJson.put("type", "boolean");
StringEntity entity = new StringEntity(requestJson.toJSONString());
httpPut.setEntity(entity);
httpPut.addHeader("content-type", "application/json");
HttpResponse response = httpclient.execute(httpPut);
if (response != null) {
if (response.getStatusLine().getStatusCode() != 204) {
throw new Exception(EntityUtils.toString(response.getEntity(), "UTF-8"));
}
}
}catch(Exception e) {
logger.error(e.getMessage());
throw e;
}
}
Why do i get this error:
execution doesn’t exist: execution is null