Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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 Marketplace Apps & Integrations

Staying organized with Jira: best practices for a better project management

Project managers know this problem: A “mountain of work” lays in front of you, and you don’t know how and where to tackle them. Different to-dos lie ahead, but just one task after the other can be ha...

248 views 2 1
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