Is it possible to do the following in the JIRA ScriptRunner Scripted Field:
* This script field it does some computation and shows a value, say issue-1.
* But the content is shown as a link on the JIRA issue view screen. Behind the scene, the content would be <a href="www.sample.com">issue-1</a>.
* Then I should be able to search the issue by this 'issue-1' value.
This is weird but I've posted an answer to this question before and it hasn't appeared.
As I said in my previous answer, yes, this is totally possible.
You simply need to select a different template from the scripted field configuration screen: the HTML template
Afterwards, just make sure that your HTML is returned as a string like so:
return "<a href=\"www.sample.com\">issue-1</a>".
Also, if you are going to search by it, make sure that you are manually indexing the issue like my coworkers have said before. You will need to use a custom listener, but be careful, because manually re indexing after every calculation using a listener will have a performance impact in your instance.
Hi Daniel - Thanks for the reply. I don't see the HTML template selection so I guess I am using an earlier version of the ScriptRunner plugin? We can't upgrade to latest version of ScriptRunner at this point. Does the search template has to be HTML in order for things to work? Can I use the exact text search to satisfy this requirement?
Regarding the indexing, for the value issue-1, the 1 is just a number from another field in the JIRA that gets changed based on other calculation in another JIRA project. I do a re-index on this JIRA issue when there's a change on other issue. Will this satisfy the indexing requirement? Again the re-index happens on this issue only when there's a change in the other project issue. Would there be a performance concern? I tested things out and everything seems OK.
What version of SR are you guys running on?
If your instance looks okay, don't worry about it. However, do keep this in check, or written somewhere just in case it could grow out of control. Maybe you did it the right way but there are a lot of people that basically force a reindex everytime an issue is viewed. I'm sure you can imagine how bad that could be for the performance of your instance.
If that is not the case, you don't have anything to worry about. But once again, better be safe than sorry :)
Hi Daniel - we use SR version 4.1.3 and will upgrade to latest version later.
When the JIRA issue is view, I notice that there's no reindex happening (I turned on the index logging and see no reindex triggered when viewing that issue). Only when the issue is updated, or the associated JIRA issue with this issue is updated, then I trigger a reindex on this issue. So I think we are good for now. Let me know if I miss something here. Thanks!
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!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
We're bringing product updates and pro tips on teamwork to ten cities around the world.Save your spot