I need help with jira libraries

Diego Alonso Orozco Gonzalez
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 3, 2020

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)

1 answer

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 4, 2020

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.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events