cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

Workflow Complete Code

BrianKrieger
10-Marble

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 2

Figured it out.

   curWorkItem.setComplete("Fast_Track");
   PersistenceHelper.manager.save(curWorkItem);
   wfAssgAct.changeState(WfTransition.COMPLETE);

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.

Announcements

Top Tags