Hello everyone. I want to update Resolution field using Groovy. For example
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.config.ResolutionManager
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.security.JiraAuthenticationContext
import com.atlassian.crowd.embedded.api.User
import com.atlassian.jira.config.ConstantsManager
def resolutionManager = ComponentAccessor.getComponent(ResolutionManager)
// MutableIssue issue = issue;
JiraAuthenticationContext jiraAuthenticationContext = ComponentAccessor.getJiraAuthenticationContext();
User loggedUser = jiraAuthenticationContext.getLoggedInUser()
issue.setResolutionObject(ResolutionManager.getResolutionByName("Done"));
But I see an error
groovy.lang.MissingMethodException: No signature of method: static com.atlassian.jira.config.ResolutionManager.getResolutionByName() is applicable for argument types: (java.lang.String) values: [Done] at Script3148.run(Script3148.groovy:13)
Hi John,
That's because you need to call getResolutionByName() method from an instance of Resolution Manager interface. Looking at your code and instance of this interface is stored in resolutionManager variable, so the correct code would be:
issue.setResolutionObject(resolutionManager.getResolutionByName("Done"));
(note the lower case 'r' in 'resolution) :)
On a side note, I've noticed that you've declared the wrong type for loggedUser variable. The correct way would be:
import com.atlassian.jira.user.ApplicationUser
ApplicationUser loggedUser = jiraAuthenticationContext.getLoggedInUser()
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.