This is my code
import com.atlassian.jira.*
import com.atlassian.jira.issue.DefaultIssueChangeHolder
import org.apache.log4j.Logger
import org.apache.log4j.Level
def issueManager = ComponentAccessor.getIssueManager()
def issue = issueManager.getIssueObject("PRUEB-1")
def String myval = "2"
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def textCf2 = customFieldManager.getCustomFieldObjects(issue).find {it.name == "Story Points"}
if (textCf2) {
def changeHolder = new DefaultIssueChangeHolder()
textCf2.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(textCf2), myval),changeHolder)
}
This is the problem
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script1.groovy: 2: unable to resolve class com.atlassian.jira.issue.DefaultIssueChangeHolder @ line 2, column 1. import com.atlassian.jira.issue.DefaultIssueChangeHolder ^ Script1.groovy: 12: unable to resolve class ModifiedValue @ line 12, column 38. textCf2.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(textCf2), myval),changeHolder) ^ 2 errors at com.adaptavist.sr.cloud.workflow.AbstractScript.parseScript(AbstractScript.groovy:51) at com.adaptavist.sr.cloud.workflow.AbstractScript.evaluate(AbstractScript.groovy:32) at com.adaptavist.sr.cloud.events.ScriptExecution.run(ScriptExecution.groovy:29) at ConsoleScriptExecution1_groovyProxy.run(Unknown Source)
Where are you eventually aiming to run this script? It looks like a hard-coded script to be run in the console as a one-off at the moment, which often means you're trying something out that you are later planning to put in a listener or post-function.
If that is the case, it would be better if we know where it's going to end up so we can use the right libraries now, rather than change them again later.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.