Last active
September 3, 2019 16:13
-
-
Save chuikoaleksandr/5b55fc7a8f74112c71f3449678469c7f to your computer and use it in GitHub Desktop.
Listener for complex priority https://atlasteam.ru/?p=1815
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.atlassian.jira.component.ComponentAccessor; | |
import com.atlassian.jira.event.type.EventDispatchOption | |
def issue = event.issue | |
def cfСomplexPriority = ComponentAccessor.customFieldManager.getCustomFieldObject(10001)//todo set MyGroovy calculate field id | |
switch (issue.getCustomFieldValue(cfСomplexPriority)) { | |
case [0d, 1d, 3d]: | |
issue.setPriorityId("5") | |
break | |
case [9d, 18d, 27d, 36d, 54d, 81d]: | |
issue.setPriorityId("4") | |
break | |
case [108d, 162d, 243d, 324d, 486d]: | |
issue.setPriorityId("3") | |
break | |
case [729d, 972d, 1458d, 2187d, 2916d]: | |
issue.setPriorityId("2") | |
break | |
case [4374d, 6561d, 8748d, 13122d]: | |
issue.setPriorityId("1") | |
break | |
} | |
update(issue) | |
def update(issue){ | |
ComponentAccessor.issueManager.updateIssue( | |
ComponentAccessor.jiraAuthenticationContext.loggedInUser, | |
issue, | |
EventDispatchOption.ISSUE_UPDATED, | |
false | |
); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment