Hi
I want to know if i'm doing things right,
In my Jira i'm using Requirement above Epic (with custom link that i've created)
I've created a script field on all my issues type that displays the 'Req Link' just like the 'Epic Link that Out of the box, It works fine!)
The thing is that unless i'm doing re-index lets say every hour, the search results are not correct (if i'm filtering by this 'Req Link' field.
So, i understand i need to do re-index but what is the best practice for that?
- Can i add it to my 'script field' script? (re index just this field?)
- Do i need to create a listener (and which one) to re index all issues all the time?
Please advise.
Thanks,
Hi Shlomi,
The right way to do it is:
Instead of scriptedfield, create regular customfield.
Than, in listener, update that regular customfield with the value you want, and inside the listener, after updating the value in the customfield, make re-index.
You can't re-index from scriptedfield as it fails and throw exception of "stackoverflow"
Hi,
Thanks For the quick reply,
In my case my company uses Jira for over a year now with a lot of Issues in the system about now, What i was asked to is to add this calculated 'Req Link' to all the issues (all over the hierarchy).
The way you describe is cool except I'll need to 'edit' all the issues in Jira so the change will take effect and I'll see the 'Req Link' field updated.
As i said, the approach i was going gave me the result i want but i need to preform re-index in time to time so the JQL will be correct.
Is it right to create a listener or some other script that will run every hour and will re-index only the 'Req Link' field in the issues? is this possible?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Than lets go for another approach.
keep your scripted field.
at the end of your scripted field, fire event (of your choice).
Create a listener that will listen to the event you fire from the scripted field, in that listener just run re-index for the issue fired the event (which is the issue run the scripted field)
Here is the code to re-index from the listener (that's all you need to put there)
import com.atlassian.jira.issue.index.IssueIndexingService;
def issueIndexManager = ComponentAccessor.getComponent(IssueIndexingService)
issueIndexManager.reIndex(event.issue)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Nir HaimovCan you please give an example code for event firing to put at the end of my scripted field?
Thanks,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.event.type.EventDispatchOption
issueManager.updateIssue(user, (MutableIssue)issue, EventDispatchOption.ISSUE_UPDATED, false);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the example but its not working, Getting an error.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Nir Haimov
Can you provide screenshot on this configuration from your scripted field and scriptrunner listener?
Thank you!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.