You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
I'm trying to implement a popup dialog on web item click using ScriptRunner. The Adaptavist docs on the subject are sorely lacking, and it doesn't seem to be widely documented elsewhere.
Can anyone point me at some resources, or provide some sample code, to help me have an assignee search field appear on the dialog?
The dialog will prompt the user to choose between available sub-task types, pick an assignee and then hits an endpoint with given data to create a sub-task.
My dialog code so far:
import com.onresolve.scriptrunner.runner.rest.common.CustomEndpointDelegate
import groovy.transform.BaseScript
import com.atlassian.jira.component.ComponentAccessor
import javax.ws.rs.core.MediaType
import javax.ws.rs.core.MultivaluedMap
import javax.ws.rs.core.Response
@BaseScript CustomEndpointDelegate delegate
createSubTask { MultivaluedMap queryParams ->
def typesOptionsHTML = ""
def allIssueTypes = ComponentAccessor.constantsManager.subTaskIssueTypeObjects.each { type ->
typesOptionsHTML += "<option value=\"${type.name}\">${type.name}</option>"
}
def issueKey = queryParams.getFirst("issueKey") as String
def dialog =
"""<section role="dialog" id="sr-dialog" class="aui-layer aui-dialog2 aui-dialog2-medium" aria-hidden="true" data-aui-remove-on-hide="true">
<header class="aui-dialog2-header">
<h2 class="aui-dialog2-header-main">Clone ${issueKey} as Sub-Task</h2>
<a class="aui-dialog2-header-close">
<span class="aui-icon aui-icon-small aui-iconfont-close-dialog">Close</span>
</a>
</header>
<div class="aui-dialog2-content">
<p>Select an assignee and issue type for the Sub-Task</p><br>
<div id="container" style="width:px">
<form class="aui">
<div id="type">
<div class="aui-dropdown2-section">Type:
<select>
${typesOptionsHTML}
</select>
</div>
</div>
</form>
</div>
</div>
<footer class="aui-dialog2-footer">
<div class="aui-dialog2-footer-actions">
<button id="dialog-close-button" class="aui-button aui-button-link">Close</button>
</div>
<div class="aui-dialog2-footer-hint">All issue details will be copied over into the new Sub-Task</div>
</footer>
</section>
"""
Response.ok().type(MediaType.TEXT_HTML).entity(dialog.toString()).build()
}
Also, as an aside, I could do with some explanation on the classes used in the Adaptavist examples. Are these implemented by JIRA - can I just use these to maintain a consistent style? Are these documented anywhere?
Thanks!!