G
G
garison20042021-04-07 08:32:20
JIRA
garison2004, 2021-04-07 08:32:20

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

1 answer(s)
A
Arty_Fact, 2021-08-16
@Arty_Fact

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 question

Ask a Question

731 491 924 answers to any question