Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Re-Index with Scriptrunner based on issue update

Jane Ellis February 24, 2021

I have done a bit of research on this topic and can't seem to find anything that solves my issue.

Our Jira application has 2 issues types, Type 1 and Type 2. Type 1 is the parent of Type 2 which is achieved by linking through the linked issue field.

There are a couple custom fields that are single select drop down menus on these issue types. When you select an option in Type 1, it automatically flows down and selects in Type 2 via a listener. HOWEVER. The issue is, that when you do this, Type 2 does not show up on JQL queries unless you re-index.

Is there a script that I can add to my existing listener that would force a re-index of that issue so that we are re-indexing and slowing Jira down all day? 

Thanks for your time!

1 answer

0 votes
Michael Aglas
Contributor
February 24, 2021

It sounds to me that there is an issue with your listener... Is it a Groovy Script or how is it done?

If it is a self created Groovy Script then ensure you correctly store the updated value on the Issue:

To actually set a custom field value, use OrderableField.updateIssue(com.atlassian.jira.issue.fields.layout.field.FieldLayoutItem, MutableIssue, java.util.Map)

in order to Record the value on the issue (not saving it to the database, see updateValue).

see: https://docs.atlassian.com/software/jira/docs/api/8.5.12/com/atlassian/jira/issue/MutableIssue.html#setCustomFieldValue-com.atlassian.jira.issue.fields.CustomField-java.lang.Object-

Jane Ellis March 3, 2021

@Michael Aglas - I don't believe there is an issue with the script. It does exactly what I need it to do by updating the fields of the child issue when the parent is updated. We just need it to re-index afterwards, apparently this is a common problem in doing research on how to fix it.

Suggest an answer

Log in or Sign up to answer