(e.g. POST to /engine-rest/process-definition/{id}/start) it creates a new process-instance with the old process-definition which is then broken and can not be completed.
How could I get rid of the old process-definitions?
Is there a posibility to tell the engine that it should only allow new instances for the latest version of a process-definition?
with the Java API, you can start a process instance by its key (which is the id that is provided in the BPMN 2.0 xml). This will always start the latest version of the process. The REST API is not feature complete though and this particular method is not exposed yet.
However, we plan to improve it for the final 7.0.0 release and I assume that this method will be implemented by then.
The same goes for the undeployment of processes.
For now, you could look up the latest version of the process definition by using
GET /engine-rest/process-definition?key=yourProcessDefinitionKey&latest=true
This will return the latest process definition with the given key and you can use its id to start it.
Best regards,
Thorben
For now, you could look up the latest version of the process definition by usingGET /engine-rest/process-definition?key=yourProcessDefinitionKey&latest=true
This will return the latest process definition with the given key and you can use its id to start it.
$.ajax({
url: "http://localhost:8080/engine-rest/process-definition",
type: 'GET',
data: {"key":"loan-approval","latest":"true"},
context: document.body
}).done(function(data) {
if(typeof data[0].id != undefined){
definitionId = data[0].id;
startNewProcess(definitionId);
}else{
alert("No process-definition found in data: "+data);
}
}).error(function(data){
console.log("ERROR:",data);
});
function startNewProcess(definitionId){
$.ajax({
url: "http://localhost:8080/engine-rest/process-definition/"+definitionId+"/start",
type: 'POST',
data: JSON.stringify({"variables":{"orderId":"mySecretOrderId"}}),
contentType: 'application/json',
context: document.body
}
).done(function(data) {
alert("New process started.\ndata:\n\n"+JSON.stringify(data));
}).error(function(data){
console.log("ERROR:",data);
});
}
Of course, I may be totally mis-interpreting why the old version was cleared.
Edward Siewick
This didn't work today. Yep, I was totally misinterpreting.