Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X
Here is what I use when I have 3 Routing options:
//Create a vector that will hold all the non-duplicated UserEvents chosen for this activity.
Vector tallyResults = new Vector( );
//Get the object representing this activity.
WfAssignedActivity mySelf = ((WfAssignedActivity) self.getObject( ));
//Get all the UserEvents for this activity. The resulting Vector may hold duplicate values of some events.
Vector userEvents = (Vector) mySelf.getUserEventList( );WfTally.setEvents(tallyResults , wt.workflow.work.WfTally.number(self, WfTally.GTE, 1, "Reject", "Approve"));
String strTally = (String)tallyResults.get(0);
if(strTally.equals("Approve"))
{
tallyResults.clear();
WfTally.setEvents(tallyResults , wt.workflow.work.WfTally.number(self, WfTally.GTE, 1, "Rework", "Approve"));
}
result = tallyResults;
The 3 routes are Approve, Reject, and Rework. Basically what I'm doing is first evaluating if there is at least one Reject vote, if so then the result will be Reject regardless of other votes. If no one selects Reject, then the result is temporarily Approve. I then use the If statement to determine if the result is Approve, if it is then I evaluate to see if anyone voted for Rework. If at least one person voted for Rework then I change the value of result to Rework. If no one voted Rework or Reject, the result will be Approve.
Hope this makes sense, and feel free to ask questions. Thanks!