Обновить приоритет проблемы в Jira - malikovalibek/groovyForJira GitHub Wiki
Обзор Автоматически обновлять приоритет задач в Jira. Это можно использовать для массового обновления приоритетов или как часть более крупного скрипта.
пример Если вопросы были открыты более одной недели, но не были переведены в состояние «Выполняется», я хочу, чтобы приоритет проблемы повысился на один уровень выше их текущего приоритета. Например, я хочу, чтобы приоритетные задачи «Низкий» были изменены на «Средний», а приоритетные «Средние» - на «Высокий».
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.event.type.EventDispatchOption
// the key of the issue we will update final String issueKey = "JRA-1"
// the name of the priority to set final String priorityName = "High"
// set to true in order to send an email final boolean sendMail = false
def issueService = ComponentAccessor.issueService def loggedInUser = ComponentAccessor.jiraAuthenticationContext.loggedInUser def issue = ComponentAccessor.issueManager.getIssueByCurrentKey(issueKey)
def availablePriorities = ComponentAccessor.constantsManager.priorities def highPriority = availablePriorities.find { it.name == priorityName }
assert highPriority : "Could not find priority with name $priorityName. Available priorities are ${availablePriorities*.name.join(", ")}"
def issueInputParams = issueService.newIssueInputParameters() issueInputParams.with { priorityId = highPriority.id }
def updateValidationResult = issueService.validateUpdate(loggedInUser, issue?.id, issueInputParams) assert updateValidationResult.isValid() : updateValidationResult.errorCollection
def updateResult = issueService.update(loggedInUser, updateValidationResult, EventDispatchOption.ISSUE_UPDATED, sendMail) assert updateResult.isValid() : updateResult.errorCollection