Is there any way which can re-index issue when particular custom field's value is changed?

Kris Han July 14, 2021

Hi Everyone,

As title, is there any way which can re-index issue when particular custom field's value has been changed? Or does anyone know how to write a listener for re-indexing issues and subtask issues? I tried some groovy scripts which were provided on other posts but it seems not working. Please help me on it. Thank you very much!

 

Best Regards,

KH

1 answer

1 accepted

0 votes
Answer accepted
Payne
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 14, 2021

If you need to reindex an issue in a script, you can do so like this:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.index.IssueIndexingService
def indexManager = ComponentAccessor.getComponent(IssueIndexingService.class)
indexManager.reIndex(myIssue)
Kris Han July 14, 2021

Hi @Payne ,

Thanks for answering my question! Sorry, I have one more question, if I want to let this reindexing script only work when customer field's value is changed, how should I write the condition in this script? Thank you very much! 

 

Best Regards,

KH

Payne
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 15, 2021

Ah, that I'm not sure about offhand. Maybe someone else can chime in with guidance on that.

Suggest an answer

Log in or Sign up to answer