It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

SriptRunner custom listener that clears label field on cloned bug does not work in version 5

We have SriptRunner custom listener that clears label field on cloned bug. It stopped working with upgrade to Jira 7/ScriptRunner 5.

Please advice. Thank you


import org.apache.log4j.Logger;
import com.atlassian.jira.component.ComponentAccessor
import org.apache.log4j.Category
import com.atlassian.jira.issue.label.LabelManager

import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.issue.Issue

//Issue Service
import com.atlassian.jira.bc.issue.IssueService
import com.atlassian.jira.issue.IssueInputParameters

import webwork.action.ActionContext

// Logger
Logger log = Logger.getLogger("LABEL::");
// Set the logging level to INFO/DEBUG as needed
def logPrefix = "LABEL:: ";
logPrefix = logPrefix + event.issue.getKey() + ":: ";


log.debug(logPrefix + "TRY Block... START")
if(event.issue.getIssueType().name == "Bug")

def linkedissueId = event.issue.getId()
def user = ComponentAccessor.jiraAuthenticationContext.getLoggedInUser()

def loggeduser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()

LabelManager labelManager = ComponentAccessor.getComponent(LabelManager)
def labels = labelManager.getLabels(linkedissueId).collect{it.getLabel()}
labels = []


log.debug(logPrefix + "TRY Block... END")
catch(Exception e)



Line 41 labelManager.setLabels(loggeduser.getDirectoryUser(),linkedissueId,labels.toSet(),false,false)


[Static type checking] - Cannot find matching method com.atlassian.jira.issue.label.Labelmanager#setlabels(com.atlassian.crowd.embedd java.lag.Long, java.util.Set<java.lang.String>, boolen, boolen) Please check if the declared type is right and if the method exits. @Line 41, column 5


And script does not work. :(





1 answer

1 accepted

1 vote
Answer accepted

I think you just need to replace




Thank you  very much, that fixed the problem. 

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Jira

We want to hear from you! How do you use Slack and Atlassian together?

Hi Everyone! My name is Mina and I am on Atlassian’s Ecosystems Marketing team. Our team is focused on our technology partnerships and marketplace apps. One of Atlassian’s partners is Slack, who ...

44 views 0 4
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you