Scriptrunner field in 'search view'

Rina Nir Solutions Partner May 31, 2016

Question refers to JIRA 7.1.4.

 

I am not sure if the following behavior is the expected behavior, or if it indicates that I forgot/misconfigured something:

Issue A is linked to issue B.

Issue A has a ScriptRunner field that displays the status name of the status of issue B. Free Text Searcher is configured for the field.

Open a Search view (columns layout) and show the column for the ScriptRunner field. Issue A is displayed with the expected value.

Transition issue B to another status --> refresh the search view --> issue A still shows up with the previous value in its ScriptRunner field.

This is wrong, and makes the ScriptRunner field 'unreliable' for searches. Is there a way to solve this?

(PS: If I open issue A in issue view then the correct value is displayed)

1 answer

1 accepted

1 vote

It's not quite this, under the hood, but the easiest way to think of this is that the values for scripted fields are calculated when the issue they belong to is indexed.  Not when arbitrary unrelated data is changed; the field has no way to "know" what you're changing elsewhere that it needs to pick up on.

So, for A to have its field updated in full, it needs to go through an indexing cycle.  But your changes to B do not cause A to be indexed. 

To "fix" this, you kind of need to add a post-function to every workflow transtion that will look at every link and kick off a reindex of the issue at the other end of the link.

 

 

Rina Nir Solutions Partner May 31, 2016

First, thanks for the quick reply at this nightly hour,

hmmm... I am contemplating if to use the solution you propose, or- if we better just have a text field on A and the post-function in the transition of B should set this value.  The advantage of keeping it as a ScriptRunner field is that it is 'blocked for edit' out of the box, but I am slightly disappointed that I still need to 'housekeep' the field the way you described.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Fadoua M. Boualem
Published Monday in Trello

Using Trello to manage events

As a Jira power user, I was at first doubtful that Trello could benefit my workflow. Jira already uses boards (ones you can customize!), so why would I even need to use Trello?! In this post you will...

466 views 7 8
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