Приоритет обновления на основе настраиваемого поля - malikovalibek/groovyForJira GitHub Wiki

Обзор Этот сценарий используется в качестве функции публикации для изменения приоритета проблемы на основе поля с одним выбором.

пример Как менеджер по продукту, у меня много проблем с настраиваемым полем, которое можно выбрать только одним нажатием, под названием «влияет». Это настраиваемое поле имеет множество параметров. Я хочу назначить приоритет проблеме в зависимости от выбранного значения.

Хорошо знать Эта функция публикации должна быть первой функцией в вашем переходе, а не последней! import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.config.PriorityManager import com.atlassian.jira.issue.customfields.option.LazyLoadedOption

final customFieldName = "Single Select List"

//Get custom field issue with this name def customFieldManager = ComponentAccessor.customFieldManager def customField = customFieldManager.getCustomFieldObjects(issue).findByName(customFieldName) assert customField: "Could not find custom field with name $customFieldName"

def customFieldVal = issue.getCustomFieldValue(customField) as LazyLoadedOption

//Create priorities def priorities = ComponentAccessor.getComponent(PriorityManager).priorities

def highestPriority = priorities.findByName("Highest") def highPriority = priorities.findByName("High") assert highestPriority && highPriority: "One ore more selected priorities doesn't exist"

//Assign priority depending on the custom field value switch (customFieldVal?.value) { case "Audit (Internal)": issue.setPriorityId(highestPriority.id) break case "Audit (External)": issue.setPriorityId(highPriority.id) break default: log.debug "No need to change the priority" break }