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

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Threshold Routing Conditional

BrianSullivan
9-Granite

Threshold Routing Conditional

Hello.

Can anyone help me with an easy routing.

Scenario:
Workflow:
Two Parallel Activities meeting at a Threshold need to set a Condtional.

If Both Activities sent "Approve" then Route Approve Path
If One Party sent "Reject" then go do the Reject Path.

I am trying with a Threshold that I set to 2.

The Conditional I attempted was code for within an Activity using the

Result= WfTally.all(self, "Approve", "Reject");


Not Sure if it's the code (Can I use the Tally in a Threshold as I would an Activity)

Or
Did I mess up the Workflow.

From the Activity: to the Threshold: I selected to Fire both Approve and Reject.... Thinking if either is selected it would go to the threshold. Or should I have left blank... It is hung at the Threshold in Testing.

Brian



8 REPLIES 8

Made a Short-Term Solution while I investigate Java Code Error:

Added TWO Ands after Parallel Activities.


1. DA Rejects ends process

2. DA Approves AND MA Approves Approve Process

3. DA Approves AND MA Rejects then Reject Process

Will be working on Java Code after Hours to Resolve and allow future expansion to a 3rd or 4th Group.

Standard Processes not useful.

1. Serial Caused a Time Lag (Notification of Tasks for Manufacturing needed to be immediate)

2. Multiple Roles in One Activity (With A Tally Vote) Not useful, as time lag back to designer if DesignApprover Rejected (which is majority case) but ManfApprover had not gotten to the Approval yet.

Hi Brian, I've done this exact thing. Should only take a minute to put into place.

Just put conditionals in place on each approval task before getting to the AND. When someone sets Approve have a workflow variable(MyVariable) set to "Approve" using the Task Transitions.

At the conditional before the AND use the following code to evaluate and route based on the variable:

if MyVariable.equals("Approve")
result = proceed;
else
result="reject";



if it follows the reject route, have it send a terminate link to the possible still running approval task and finish the reject workflow.

if it follows the approve route, then it goes to the "AND" workflow and waits for the second one.


In mine I also added visibility to the Workflow Tasks so that each user could see what the other users "Vote" was. I had to build in a dynamic refresh loop for the task as variables on a Task are static and don't update dynamically (they are just a snapshot). It would show "Undecided" or "Approved"...reject obviously canceled everything and notified the user of this.


[cid:image001.gif@01CBB70E.642347D0]

Steve Vinyard
Application Engineer

I may not have read the thread in detail but why not make to global variables , booleans and set them to false. I am assuming your using routing options approve and reject. well on the approve set the boolean to true on the reject do nothing. on the conditonal do (if boolean1 == true && boolean2==true) result="approve"; else result="reject";

booleans use up less memory and compare faster is why i used them...., also they can be scaledto put on each transitionwhich produces less checking.also ifyou want it not to wait then check for that an throw it to an OR that terminates the before procedings. Ands work good for your situation but i would use booleans with the or condition to kill the others. Just a personal preference. Because i like to see what the booleans are set to in the process manager and i can back track why they got that way fast.

Thanks Matt and Steve,

I was afraid I would have to use a Variable.....

I was hoping that the Routing Value(Approve or Reject) from the Previous Activities could be used in the condition statement.

Sounds like I will remove the Routings from the Previous Activities and replace with an activity/global variable(2) which I can then do the condition against.

No one responded with what the OOTB Variable might be for the Previous Activities(2) Routing... and whether I could use in the downstream conditional.

Brian

On complete transition if rejecting broadcast event and have syncrhonize listen for it?


Sent from my Verizon Wireless BlackBerry

Dave,
just a queston. I thought sync robots were heavy and buggy at times....why would this better than a boolean with a conditional? other than the fact that it is instant and requires less coding up front. Doesnt it listen to all the transactions for the wf and check for them. seems like overkill for this situation or am i totally off?

Hello.

Had an hour yesterday to fix my Promotion workflow, Thanks to Matt and Steve for suggestions. I replaced my temporary workflow where I used two parallel AND conditionals. It worked fine with no Java needed but would start to get ugly if site adds 3rd or 4th approval for government projects.

Goal: Was Notification of Task in Parallel but allow Process to end Early in Design Approver found an Issue. Time-Delay of Serial Process was unacceptable; Having to wait for all Voters in an Activity unacceptable if Design Approver Rejected was unacceptable. Also Manufacturing could Reject but they wanted Design Approver to always have a chance to comment so Straight Reject from either Activity was out.

Solution:
Replaced Two And Statements in my Temp Workflow with One Threshold Conditional in Production Workflow

Added Global Variables
Approval_1 and Approval_2 as Java String

Design Approver Activity
Routes Reject Directly to rejection path
Routes Approve to Threshold Conditional.
Added Local Variable (Visible Off)
Added Transition for Approve: Approval_1="Approve";

Manufacturer Activity
Routes BOTH Reject and Approve to Threshold Conditional
Added Local Variable (Visible Off)
Added Transition for Approve: Approval_2="Approve";
Added Transition for Reject: Approval_2="Reject";

In Threshold Conditional (Firing set to 2)
Route Choices Approve & Reject
Conditional Statement added:

If (Approval_1.equals("Approve") && Approval_2.equals("Approve")
result="Approve";
else
result="Reject";

Thanks for suggestions and most importantly Syntax!
Brian
PS
Note: I understand Variable for Approval_1 was not necessary and was not necessary in my java code for my specific case but wanted to add flexibility incase decision to reject on equal footing was decided later. Simply change to change which way the Reject Link flowed for the 1st Activity and I could explain over the phone how to make the change.
PPS
No one gave suggestion on how to use the actually routing values which was start of this thread. Either not capable or internal variable name not known. LocalVariable with Transition was unanimous alternative.
PPS
Multiple ANDs was a fine choice... but if four activities could lead to four ands and a whole lot of crisscrossing links.


From: Hoover,Matthew,IRVINE,R&D [
Announcements

Top Tags