Reject a Task using DFC

Hi,

I have a workflow which contains a Reject Flow (the red arrow on designer) and a regular flow on a task (let's say task X).
I want to reject this task using DFC. However, the "reject" is not one of the operations that IDfWorkitem handle.

So, how can I make this operation? Is there a query or a DFC method for doing this operation?

Thanks,

Tagged:

Comments

  • From a runtime perspective, a reject flow is the same as regular flow.  You just need to tell specify which flow you wan to transition to.  Red arrow (and notion of reject) is purely a design time UI feature.
  • stuc0
    edited August 20, 2020 #3
    Thanks, @DCTM_Guru
    I found something (http://www.javablog.fr/dctm-java-useful-dfc ) and I believe it works.
    Following code, takes the queue item's object id as input and rejects the task.

    </code><code>public int rejectTask(String qitemId){<br>	IDfSession session = null;<br><br>	try{<br>		session = getSession();<br>		<br>		IDfQueueItem qitem = (IDfQueueItem) session.getObject(new DfId(qitemId));<br>		IDfWorkitem witem = qitem.getWorkitem();<br><br>		if(witem != null){<br>			if(witem.getRuntimeState() == 0)<br>				witem.acquire();<br><br>			IDfList activities = wi.getRejectActivities();<br>			IDfList list = new DfList();<br>			list.append(activities.get(0));<br>			wi.setOutputByActivities(list);<br>			wi.complete();			<br><br>			return 0;<br>		}<br><br>		return 1;<br><br>	}<br>	catch(Exception e) {<br>		e.printStackTrace();<br>		return -1;	<br>	}<br>}