Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Scriptrunner: Dialog to feature assignee search field

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!!

 

 

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira

Admins, notify your Jira instance of system-wide changes with the new admin announcement banner

Hi All! We’re excited to share the launch of an announcement banner that lets Jira site administrators communicate directly to their users across Jira Cloud instance.   📢 Get y...

22 views 0 2
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you