[Workflow][Kanban Board] How to block cards moving to a stage based on stage issue count.


When using a kanban board you are allowed to set a maximum number of issues for each stage. However the users are not prevented from adding more issues if that limit exceeds. Instead it will just make the column for that stage red. Besides if you filter only certain issues that "coloring" rule won't apply as it seems it is a binding rule on the UI only. I am looking for a solution to prevent the users from moving the issues when the limit is already reached.

I see there is a kanban workflow rule that prevents the card being moved if its kanban state is not "ready to pull". I wanted to create a custom rules based on that but I don't know how to check the stage issue count. Is there a way getting that? Is there a way of getting the configured limit for each stage that I was mentioning above so I won't hardcode it in the rule?

Official comment

Hello Alexandru,

You can get the stage issue count using the search function (refer to the documentation: https://www.jetbrains.com/help/youtrack/incloud/v1-search.html). The example of using 'search' can be found here: https://www.jetbrains.com/help/youtrack/incloud/using-workflow-api.html#find-multiple-issues.

In your rule, you'll need to query all the issues of the stage (i.e., Stage: Done), and then check the size of the returned set. This size is the stage issue count. 

As for getting the configured limit for the stage - unfortunately, it's impossible for now. Please feel free to create a feature request in our tracker: https://youtrack.jetbrains.com/issues



Thanks for the answers. It feels like this should be an out of the box feature otherwise I don't see the point of being able to limit the count on a column but still allow others to move items in it or even not applying the "red coloring" rule if you filter down the issues. Seems an unfinished product.


Thank you for the feedback, we will consider it for our future releases. 


Please sign in to leave a comment.