Page 1 of 1

Workflow CANCEL Button

PostPosted:Thu Jan 31, 2019 10:23 am
by f4569
Hi, I'm testing the Invoice approval workflow included into the development distribution.
When the "revisor" or the "approver" press the Cancel Button, the workflow goes into cancel node state and stops there but still "running".
How is possible to force the workflow to the END state and quit ?

Re: Workflow CANCEL Button

PostPosted:Sat Feb 02, 2019 11:59 am
by jllort
You are talking about this workflow https://docs.openkm.com/kcenter/view/wf ... ample.html

If my memory does not fail it moves to end, but it is not immediate, might take some seconds or minute until it is moved.

Re: Workflow CANCEL Button

PostPosted:Mon Feb 04, 2019 11:46 am
by f4569
Hi, I'm referring to the wf4 exercise included into the development distribution virtual machine (.ova).

it is related to an invoice approval workflow
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>

<process-definition  xmlns="urn:jbpm.org:jpdl-3.2"  name="invoiceWorkflow">


	<swimlane name="initiator"></swimlane>


	<start-state name="start-state">
		<task swimlane="initiator"></task>
		<transition to="decision"></transition>
	</start-state>


	<decision name="decision">
		<handler class="com.openkm.workflow.decision.InvoiceDecision"></handler>
		<transition to="revisor" name="review"></transition>
		<transition to="approver" name="approve"></transition>
	</decision>

	<task-node name="revisor">
		<task name="revisor">
			<assignment actor-id="fcurcio"></assignment>
		</task>
		<transition to="approver" name="reviewed"></transition>
		<transition to="user" name="userReview"></transition>
		<transition to="cancel" name="cancel"></transition>
	</task-node>

	<task-node name="approver">
		<task name="approver">
			<assignment actor-id="rcurcio"></assignment>
		</task>
		<transition to="revisor" name="review"></transition>
		<transition to="end-state" name="aproved"></transition>
		<transition to="cancel" name="cancel"></transition>
	</task-node>

	<node name="cancel">
		<action class="com.openkm.workflow.action.InvoiceCancelationAction"></action>
		<transition to="end-state"></transition>
	</node>

	<task-node name="user">
		<task name="user" swimlane="initiator"></task>
		<transition to="revisor" name="review"></transition>
	</task-node>


	<end-state name="end-state"></end-state>


</process-definition>
the invoice cancelation action is the following:
Code: Select all
package com.openkm.workflow.action;

import org.jbpm.graph.def.ActionHandler;
import org.jbpm.graph.exe.ExecutionContext;

public class InvoiceCancelationAction implements ActionHandler {
	private static final long serialVersionUID = 1L;

	@Override
	public void execute(ExecutionContext executionContext) throws Exception {
		System.out.println("Invoice has been canceled");
	}
}
when the approver or the revisor click on the cancel button, the workflow goes into the "cancel" node and stays there. Does not proceed to the end-state.
Therefore, for example, it is not possible to delete that document because it is still locked by the running workflow.

How can I stop the workflow when a user cancel it ?

Re: Workflow CANCEL Button

PostPosted:Thu Feb 07, 2019 7:04 pm
by jllort
Cancel jump to "state" node or "task node" ? Share with me and screenshot.

Re: Workflow CANCEL Button

PostPosted:Fri Feb 22, 2019 3:56 pm
by f4569
I Jllort, I solved by jumping directly to final end state instead of passing trough the intermediate cancel state. Now it works.

Re: Workflow CANCEL Button

PostPosted:Fri Feb 22, 2019 7:04 pm
by jllort
Good news.