I have a Process Flow model where I am attempting to use a Custom Code activity with the Release Token option to hold tokens at that Custom Code until/unless a certain condition is met. The actual model I'm working with is very large and contains proprietary information, so I created and attached an example model to demonstrate what I'm trying to do.
In this example model, I only want tokens to proceed to the next activity (the Delay) if their label num is equal to 1. The code I have inside the Custom Code activity is as follows:
Since I have the releasetoken function inside an if statement checking the value of num, tokens with num equal to 2 or 3 should not be able to proceed past the Custom Code activity, but when I run the model I find that all tokens proceed to the Delay, regardless of the value of num. How can I fix this so that only tokens that fulfill my condition are allowed to proceed from the Custom Code activity, and all others are held there? In my real model, the condition I'm checking is not related to a token label and will eventually be fulfilled for all tokens, so eventually all tokens will be able to/need to leave the Custom Code activity, but I need them to stay there until that condition is fulfilled by other operations in the model.