Hi,
I have a script that create two substaks and I'm trying to set a label on my "subtask1".
Before I have a different script that was setting the label, even with permission "Edit Issue" denied for normal users, but now that I created theses differents scripts it is not possible to set this label for subtask1.
SCRIPT 1 THAT CREATE MY SUBTASK:
def subTask1 = SubTask.createSubTask(issue, "Execute Maintenance Window", "SPB", "O&M task", dtMWDate, dtStartDate, dtMWDate, userOm)
SubTask.setLabel(subTask1, "MW")
def subTask2 = SubTask.createSubTask(issue, "Close RFC Ticket", "SPB", "O&M task", dtMWDate+14, dtStartDate, null, userOm)
SCRIPT 2 TO SET LABEL:
static void setLabel(Issue issue, String strLabel) {
Logger log = Logger.getInstance("tools.SubTask")
log.setLevel(org.apache.log4j.Level.INFO)
def user = ComponentAccessor.jiraAuthenticationContext.getLoggedInUser()
LabelService labelService = ComponentAccessor.getComponent(LabelService)
AddLabelValidationResult validationResult = labelService.validateAddLabel(user, issue.getId(), strLabel)
if (!validationResult.errorCollection.hasAnyErrors()) {
labelService.addLabel(user, validationResult, false)
log.info "Label '${strLabel}' set to issue ${issue}."
} else {
log.error ${validationResult.errorCollection}
}
}LOG ERROR:
2017-05-25 16:33:32,822 http-nio-8081-exec-24 ERROR supplier.team 993x16314x1 kg958x 10.192.63.100 /secure/QuickCreateIssue.jspa [c.o.s.jira.workflow.ScriptWorkflowFunction] Script function failed on issue: SDP-7765, actionId: 1, file: TaskCreationDispatcher.groovy
groovy.lang.MissingMethodException: No signature of method: static SubTask.$() is applicable for argument types: (SubTask$_setLabel_closure3) values: [SubTask$_setLabel_closure3@12ee538c]
Possible solutions: is(java.lang.Object), run(), run(), any(), any(groovy.lang.Closure), use([Ljava.lang.Object;)
at SubTask.setLabel(SubTask.groovy:235)
at SubTask$setLabel$1.call(Unknown Source)
at SI_-_Software_Version_Upgrade.run(SI - Software Version Upgrade.groovy:45)
at TaskCreationDispatcher.run(TaskCreationDispatcher.groovy:29)
How can I do it?