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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Get value of custom script field is always 0

Hi at all,

in our company we use JIRA Server 8.5.1. I have two questions and hopefully someone could help. We have the Scriptrunner in use to calculate some more detailed values, .e.g. for the functional progress.


I have already used the following line to retrieve a value of a custom scripted field (number field) and it is working:

def customFieldValue = ComponentAccessor.customFieldManager.getCustomFieldObject("customfield_YYYYY").getValue(issue)

Now we needed another custom scripted field which also needs the value from another scripted field. This field is visible on the belonging issue, it has a value different from 0. I can also access this value from the script console. But when I use the exactly same code within the script for the scripted field, it always says that the field's value is 0.

We are completely lost here, as I wrote before, exactly the same code works in multiple other scripted fields. Do you have any ideas? The only thing we could image is that the other scripted fields are limited to four specific projects and the newly created scripted field is global. Could that be the reason?


When I use logging in a scripted field by invoking log.debug and then pressing the preview button, no log shows up even when I use log.setLevel(Level.DEBUG) before. In other scripted fields I bypassed this by using my own logger: logger=Logger.getLogger("") Now I tried it this way as usual and it is not working. The funny thing is that when I use a name for the logger which is already in use for another scripted field, e.g. logger=Logger.getLogger("") the logging works by pressing the preview button.

It would be really helpful if someone could provide help, especially for the first question.



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.
Jun 16, 2020

Is the second scripted field on the same issue as the first one?

This will often break because you can't be sure which field will be recalculated first when the issue is reindexed (or, in fact, how many times!).  The way to "fix" that is to not base a scripted field on another one if they're going to be indexed in the same batch (i.e. same issue).  Most of the time, you have to duplicate the code. 

If, for example, you have

field a = x + y

field b = a + z

Replace the second one with a duplicate calculation, such that field b = x + y + z

Thanks for your answer! The scripted fields are for different issues.

The first issue is of type A and has a scripted field AFunctionalProgress. The second scripted field (the new one) is for issue type B and therefore its name is BFunctional Progress. Multiple issues of type A could be linked to type B. I iterate through all these issues of type A and try to get AFunctionalProgress with the mentioned code.

It is strange that the thing you describe always works in our cases. For issue type A, we have the scripted fields AValue1 and AValue2 where AValue2 needs is based on AValue1.

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events