I tried using both scripts on https://answers.atlassian.com/questions/307827 but neither were successful. When adding the script, the error says "cannot find matching method...". Has anyone been successful with this? Thank you!
"cannot find matching method..."
That's all about error or is there something else? Seems to be something more.
Try to debug both scripts in a script runner - works for me as well.
The API may have changed since that answer. As Aleks said, the useful part of the error you get is in the "...".
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.label.LabelManager def user = ComponentAccessor.jiraAuthenticationContext.getUser() LabelManager labelManager = ComponentAccessor.getComponent(LabelManager) def labels = labelManager.getLabels(issue.id).collect{it.getLabel()} labels += 'new_label' labelManager.setLabels(user,issue.id,labels.toSet(),false,false)
The error I get is:"Static Type Checking -Cannot find matching method: com.atlassian.jira.issue.label.LabelManager#setlabels(com.atlassian.jira.user.Ap java.lang.Long, java.util.Set , boolean, boolean). Please check if the declared type is right and the method exists"
The exact script I'm getting this error on is below (the code block above didn't work for some reason):import com.atlassian.jira.component.ComponentAccessorimport com.atlassian.jira.issue.label.LabelManagerdef user = ComponentAccessor.jiraAuthenticationContext.getUser()LabelManager labelManager = ComponentAccessor.getComponent(LabelManager)def labels = labelManager.getLabels(issue.id).collect{it.getLabel()}labels += 'new_label'labelManager.setLabels(user,issue.id,labels.toSet(),false,false)
It looks like you're new here. Sign in or register to get started.