Jira does not refresh a scripted custom field even when the links to calculate this scripted field

Jira does not refresh a scripted custom field even when the links to calculate this scripted field have been modified. It seems that when you clone an issue with a scripted custom field, you can not modify it. So my question is how do you modify a scripted field on on a Jira issue? Do you use REST API or write a groovy script to modify it?

2 answers

0 vote
Alexey Matveev Community Champion Jan 03, 2018

Hello,

Do you mean Scriptrunner Scripted Field? If so, then Scripted Fields do not store any value. There is a script inside the field which produces a value. I guess you need to change the script. Go to cog item->add-ons->scripted fields. Then find your field and choose edit. You will be able to change the script.

If it helps, there's an oversimplified way to think of it. 

The fields are read-only because they are calculated, not entered.  A scripted field's data is updated when the issue the field belongs to is re-indexed for any reason.

You can't modify the values of a scripted field because they don't really exist.

Nic, I forget, does the value of a scripted field usually depend on the cached data for the issue or what is in the Lucene index? I think it might be the former

Mostly the cached value.  It sees the Lucene index as the "source of truth", but in most cases looks for the cached value before reading the index.

(This is a lot of the reason I say "oversimplified" when I say "scripted fields are calculated when indexing")

0 vote
Steven Behnke Community Champion Jan 03, 2018

Disable the caching on the scripted field. This is basically required when scripting a field that 'talks' to linked issues.

https://scriptrunner.adaptavist.com/latest/jira/scripted-fields.html#_more_advanced_notes_on_caching

enableCache = {-> false}

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Monday in Jira Software

How large do you think Jira Software can grow?

Hi Atlassian Community! My name is Shana, and I’m on the Jira Software team. One of the many reasons this Community exists is to connect you to others on similar product journeys or with comparabl...

694 views 6 13
Read article

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