Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Listener for complex priority https://atlasteam.ru/?p=1815
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
You can’t perform that action at this time.