Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,363,252
Community Members
 
Community Events
168
Community Groups

Scriptrunner Custom Field Issue Template configure fields shown

Hi,

i have a scriptrunner custom script field which collects some specific Issues and renders them, using the Issue(s) Template.

This is working well and renders the Issuetype Icon, the Issue Key as a Link, the Summary, the Priority Icon and the Status, as expected.

 

I would like it to also render the resolution. Is this possible to configure somehow?

 

I am aware, that i could just write custom HTML Code, however that feels not the way to go, when there already exists an Issue renderer.

 

Thank you very much for your time!

 

Best Regards,

Florian

 

1 answer

Hi Florian, 

Olly here from Adaptavist's ScriptRunner Support!

Using the Issue Picker Built-In Scripted Field, we can use one of Adaptavist's examples in our Documentation with some modification to get the 'Resolution'

I've modified the code a little bit for 'Resolution':

import com.atlassian.jira.issue.Issue
import com.onresolve.scriptrunner.canned.util.OutputFormatter

getSearchFields = {
['issuekey', 'summary', 'resolution']
}

renderOptionHtml = { String displayValue, Issue issue, Closure<String> highlight ->
OutputFormatter.markupBuilder {
i('Resolution: ' + issue.resolution?.name)
mkp.yield(' - ')
mkp.yieldUnescaped(displayValue)
}
}

(Please refer to the OutputFormatter Markup Builder docs for further formatting info)

This will return the following:

Screenshot 2022-09-01 at 12.56.28.png

Do note though that it also returns Issues with no Resolution, i.e. the two Issues I have in the example with null as they haven't been resolved.

To remove these Issues with no resolution, you'd just need to add 'resolution != null' to the JQL query:

Screenshot 2022-09-01 at 13.03.39.png

Which then shows:

Screenshot 2022-09-01 at 13.03.57.png

Hope this answers your query!

Thanks,

Olly

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events