I am new to this so sorry if this is a noobie question - I have very little experience atm with groovy.
Hoping to get some help with this.
What I am after, is a panel added to a issue that returns the last issues (e.g. 10) that the reporter have created.
I found that the Scriptrunner can use the panel with Script Fragments -> Show a web panel.
But I got no idea how to write this code (Privder class/script field).
Can someone help me with the code? Seeing code like this also helps me in understanding this beter.
Hi!
I realize I am answering an old question but maybe someone scratching your head and, like me, stumbled upon this thread. I found a way to do this using UI fragments.
First, create a UI fragment as type Custom Web Panel (show a web panel). Then add any conditions (for example if you only want to do this in specific projects or for specific users) and then add this script:
import com.adaptavist.hapi.jira.issues.Issues
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.RendererManager
def rendererManager = ComponentAccessor.getComponent(RendererManager)
def fieldLayoutManager = ComponentAccessor.fieldLayoutManager
def currentIssue = context.issue as Issue
Issues.search("""project = '${currentIssue.projectObject.key}'and reporter = '${currentIssue.reporter.name}' and key != '${currentIssue.key}' ORDER BY created DESC""").take(10).toList()
.each { issue ->
def fieldLayoutItem = fieldLayoutManager.getFieldLayout(issue).getFieldLayoutItem("key")
def renderer = rendererManager.getRendererForField(fieldLayoutItem)
writer.write("${renderer.render(issue.key, null)} - ${renderer.render(issue.summary, null)}<br/>")
}
hi there,
this might help you get started with some basics: https://scriptrunner.adaptavist.com/4.3.4/jira/fragments/WebPanel.html#_conditions
but what I would do it:
I hope this helps a bit.
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.