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

How to get project information in Scriptrunner dialog window?

Hi folks, 

i have created dialog window for my project as described here:

There are some qlitches in JIRA v6.3.1x with javascript, for example the script handling the dialog window is loading only on some pages. 

But with JIRA 7 this is solved, so since our customer is going to upgrade to version 7, there is no bother with this.


So what I am trying to do is:

I have a button in the blue administration stripe as a Script-fragment/Custom webitem defined in Scriptrunner - this opens the dialog.

It calls the REST end point (Show Dialog) which is similar to the one on adaptavist page mentioned above.


I can not figure out how to get current project information in this REST end point and fill the information to the returned html template.

Maybe its easy and i am just overlooking something due to lack of my experience with Scriptrunner and JIRA and maybe its not possible to do so at all.

The dialog creates new project version and I dont have any issue context, we should be able to cal it from anywhere within project administration. 

Anyone have some suggestions??  

2 answers

Hey Martin, 


It depends on the the context of the web item. 

So for example if the context of your web item is the operations-top-bar, as in the example, then and assuming that your rest endpoint is


 then in the script fragment link you can have 


and then in your rest endpoint you can retrieve the project.

Something like 

import com.atlassian.jira.component.ComponentAccessor
import groovy.transform.BaseScript


@BaseScript CustomEndpointDelegate delegate

doSomething() { MultivaluedMap queryParams ->

def issueId = queryParams.getFirst("issueId") as Long
def project = getProjectFromIssueId(issueId)
log.debug "Project key is ${project.key}"

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">Some dialog</h2>
<a class="aui-dialog2-header-close">
<span class="aui-icon aui-icon-small aui-iconfont-close-dialog">Close</span>
<div class="aui-dialog2-content">
<p>This is a dialog...</p>
<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 class="aui-dialog2-footer-hint">Some hint here if you like</div>


def getProjectFromIssueId (Long issueId) {

def issue = ComponentAccessor.issueManager.getIssueObject(issueId)

// you have the project do something

Hope that helps.



Hey Thanos,

thanks for the reply. Yeah your example is correct, that is what i have here - of course without the param.

I just assume here now, but if I open JIRA first time, open the project admin part ie: Versions tab and then click the button to open the dialog, there will be no issue context right? Because i did not open any issue yet. so the param will be null in this case right?

Well i am going to try to fiddle with it, maybe i will find the way :)


thanks again, any ohther ideas are very welcome.


Of course you can just do something like this, when you define Script fragment calling your showDialog endpoint.




thanks again


Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published Apr 03, 2019 in Marketplace Apps

How to estimate projects more accurately?

Gaining insight into your team’s effectiveness and choosing the right estimation technique.   Estimating projects is hard. It is because people have the tendency to underestimate the time thin...

278 views 2 8
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you