cancel
Showing results for 
Search instead for 
Did you mean: 

Cancel Workflow

luisalves00
Champ in-the-making
Champ in-the-making
activiti Contains this record:

SELECT * FROM activiti.act_hi_procinst a WHERE PROC_INST_ID_=3701;   //ID_ is the same

then I do:
engine.getRuntimeService().deleteProcessInstance(String.valueOf(authorizationRequestObject.getIdWorkflow()),"Deleted");
          __________________________

the ID comes from (an execution):

//set the id of the workflow
pa.setIdWorkflow(BigInteger.valueOf(Long.valueOf(execution.getProcessInstanceId())));

throws this exception

15:28:00,507 ERROR AuthenticationController:46 - No process instance found for id '3701'


any idea?
1 REPLY 1

luisalves00
Champ in-the-making
Champ in-the-making
Don't know if this is the correct way to doit…
but:

try {
                    engine.getHistoryService().deleteHistoricProcessInstance(String.valueOf(authorizationRequestObject.getIdWorkflow()));
                    } catch (Throwable t) {
                        engine.getRuntimeService().deleteProcessInstance(String.valueOf(authorizationRequestObject.getIdWorkflow()), "Deleted");
                        engine.getHistoryService().deleteHistoricProcessInstance(String.valueOf(authorizationRequestObject.getIdWorkflow()));
                    }

this seems to work….