Skip to main content
10-Marble
Question

Workflow Complete Code

Hey, all!  We're trying to complete a workflow task.  When using it against a Routing-based workflow, no worries.  When used against a Transition-based workflow, the task completes but doesn't move to the next workflow step.  Workflow is still running.  Code:

ReferenceFactory refFactory = new ReferenceFactory();

WTReference workitemref = refFactory.getReference(obidIn);

WorkItem curWorkItem = (WorkItem)workitemref.getObject();

WfAssignedActivity wfAssgAct = (WfAssignedActivity)curWorkItem.getSource().getObject();

ProcessData data = wfAssgAct.getContect();

WfVariable[] list = data.getVariableList();

String associagedOID = (String)list[1].getValueObject();

WTReference wtref = refFactory.getReference(associatedOID);

Object workable = wtref.getObject();

Vector results = new Vector();

results.add("Complete");

wfAssgAct.complete(results);

Thoughts?

2 replies

10-Marble

Figured it out.

   curWorkItem.setComplete("Fast_Track");
   PersistenceHelper.manager.save(curWorkItem);
   wfAssgAct.changeState(WfTransition.COMPLETE);
Translate
10-Marble

To follow up, the .setComplete("string") code sets an attribute for who approved it.  So the code should call the current principal and put their username into that field.

Translate