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
Script:
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
import com.atlassian.jira.issue.link.IssueLink;
//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
log.setLevel(org.apache.log4j.Level.DEBUG);
def logPrefix = "LABEL:: ";
logPrefix = logPrefix + event.issue.getKey() + ":: ";
log.debug(logPrefix)
try
{
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 = []
labelManager.setLabels(loggeduser.getDirectoryUser(),linkedissueId,labels.toSet(),false,false)
}
log.debug(logPrefix + "TRY Block... END")
}
catch(Exception e)
{
log.error(e.getMessage())
}
Line 41 labelManager.setLabels(loggeduser.getDirectoryUser(),linkedissueId,labels.toSet(),false,false)
shows
[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. :(
I think you just need to replace
labelManager.setLabels(loggeduser.getDirectoryUser(),linkedissueId,labels.toSet(),false,false)
with
labelManager.setLabels(loggeduser,linkedissueId,labels.toSet(),false,false)
Thank you very much, that fixed the problem.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.