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

WfTally - adding a third event

rjacobsen
1-Newbie

WfTally - adding a third event

Hello All,
I need to add a third routing event "Reject" to the code below in my change Notice workflow for a "Vote" activity. How do I add this? I want to Approve if all approve and Reject or Amend if any 1 person Rejects or Amends.

The code I am using:

WfAssignedActivity mySelf = ((WfAssignedActivity)self.getObject());
if (result !="Approve") {
//Set result to "Approve" if it has been chosen by all of the required users. In all other cases, set to Amend.
result = WfTally.all(self, "Approve", "Amend"); }

I have tried just adding the event after "Amend" and have tried changing WfTally.all to .any

Thanks in advance,
Russ Jacobsen
Director, Sustaining & Implementation
YAKIMA Products Inc.


1 REPLY 1

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!

Announcements