Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

I need help with jira libraries

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

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

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