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

This widget could not be displayed.
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")

This widget could not be displayed.
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
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...

134 views 2 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