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

helen levich Apr 23, 2019

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
Peter-Dave Sheehan Apr 23, 2019

I think you just need to replace



helen levich Apr 23, 2019

Thank you  very much, that fixed the problem. 

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Jira

Try Jira Cloud for Outlook: Organize your work without leaving your inbox

Hi Atlassian community, My name is Max and I work on the product integration team at Atlassian. I am pleased to announce the early access program for the Jira Cloud add-in for Outlook. This add-in...

2,361 views 6 15
Read article

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