Answer the question
In order to leave comments, you need to log in
How to write a validator for Jira on a script runner to calculate the number of issue by condition?
I need a validator script to count the number of search tasks
(status = "IN PRODUCTION" AND assignee in (currentUser()))
I want to check the condition for no more than 3 tasks
Answer the question
In order to leave comments, you need to log in
In general, this is a rather controversial undertaking in this way to check the number of tickets a user has in work (if I understand the task correctly, of course).
And it will be something like this:
import com.atlassian.jira.bc.issue.search.SearchService
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.jql.parser.JqlQueryParser
def jql = "status = \"В ПРОИЗВОДСТВЕ\" and assignee = currentUser()"
def query = ComponentAccessor.getComponent(JqlQueryParser).parseQuery(jql)
def user = ComponentAccessor.jiraAuthenticationContext.loggedInUser
return ComponentAccessor.getComponent(SearchService).searchCount(user, query) <= 3
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question