JIRA Calculated field based on another script field

Hi,

This is based on https://answers.atlassian.com/questions/186846/jira-calculated-field-based-on-another-calculated-field (which was closed due to some blog bug)

I have a Jira custom field setup that includes several scripted fields with pieces of common logic. So, field 1 returns some number based on issue fields, field 2 returns some more info based on number in field 1 etc

As you might guess, i'm not fond of copy-pasting scripting code from one script to the other, but all my attempts to use getFieldValue to get the current value of another SCRIPTED field returned NULL/empty values. Am i missing anything?

The code is simple

Field1 (scripted field)returns constants depending on issue fields, type etc (simplified version here):
return 5

Field 2 (scripted field) looks like:
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.fields.CustomField
def custField = customFieldManager.getCustomFieldObjectByName("Field 1")
if (custField)
return issue.getCustomFieldValue(custField) // TODO: some transform
else
return null

--

this always produced null / empty for Field 2

1 answer

This widget could not be displayed.

It's the same question you asked earlier

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 yesterday 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...

79 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