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.

Matt Doar Community Champion Jan 03, 2018

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 Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,314 views 14 20
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot