Reference a Scripted Field in another Scripted Field


Is it possible to reference an existing script field in another script field with the Script Runner plugin (v2.1.15)?

I've got a scripted field that calculates the response time in hours for an issue and now need another field to set a "Breached SLA" flag on the ticket. Ideally I'd like to be able to reference the Response Time in the new field so I can just say Response Time > 4, for example, rather than having to duplicate the Response Time logic in the second scripted field, but the following just produces "Server Error" when trying to preview the field on the Sctiped Field screen and nothing in the logs:

def responseTime = getCustomFieldValue("Time to Respond");

if (responseTime > 4) {
  return "Yes";
} else {
  return "No";

Am I doing something wrong, or do I have to duplicate the logic because you can't reference a Scripted Field from another Scripted Field?



2 answers

1 accepted

This widget could not be displayed.

Hello Andrew,

you need to replicate your "Time to Respond" code into the second scripted field. You can't use an existing scripted field.

Hope this helps,


This widget could not be displayed.

You can do that... can you post the stack trace?

Hi Jamie,

Checking again it's given me a stack overflow:

        at groovy.lang.MetaClassImpl.getMethods(
        at groovy.lang.MetaClassImpl.getMethodWithoutCaching(
        at groovy.lang.MetaClassImpl.pickMethod(
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(
        at groovy.lang.MetaClassImpl.invokeMethod(
        at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(
        at com.onresolve.jira.groovy.ScriptManagerImpl$_getAsActualType_closure9.doCall(ScriptManagerImpl.groovy:299)  <+2>
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(
        at groovy.lang.MetaMethod.doMethodInvoke(
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(
        at groovy.lang.MetaClassImpl.invokeMethod(
        at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(
        at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(
        at org.codehaus.groovy.runtime.dgm$149.invoke(Unknown Source)

"Time to Respond" is my existing Scripted Field and I'm previewing it against an issue that has a value of 405 for tha field. I'm previewing in the Script Fields view rather than the Console.

Sorry, my mistake, it is a bug and Fabio is correct. I have fixed it for the next release, please watch get notified about when the release happens...

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

83 views 1 0
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you