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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


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
Community Members
Community Events
Community Groups

Web-item with a dialog


Good day! 

I need to add a button to the issue, available to anyone who can see the issue.

On click it should show a dialog with a text field (for ex., Label). Inserted value should be added to the Labels of the issue. 

Now I made the following - custom web-item added, endpoint created, it shows the dialog.

import groovy.transform.BaseScript


import org.apache.log4j.Logger;
def log = Logger.getLogger("com.onresolve.jira.groovy");

@BaseScript CustomEndpointDelegate delegate

showDialog() { MultivaluedMap queryParams ->

// get a reference to the current page...
// def page = getPage(queryParams)

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>Testing a dialog button...</p>

<form class="aui">
<div class="field-group">
<label for="text-input">Labels to add<span class="aui-icon icon-required">required</span></label>
<input class="text" type="text" id="text-input" name="text-input" title="Label to add">
<div class="description">Test description</div>


<footer class="aui-dialog2-footer">
<div class="aui-dialog2-footer-actions">
<button class="aui-button aui-button-primary">Save</button>
<button id="dialog-close-button" class="aui-button aui-button-link">Close</button>
<div class="aui-dialog2-footer-hint">Test hint</div>


Now how can I get the value from  text-input  to update the issue? I'm not very familiar with html / js.

Thank you in advance. 

1 answer

0 votes
Matthew Clark
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 19, 2019 • edited

Hi Saida

I would start by creating another rest endpoint that takes 2 parameters.
Parameter 1 would be the issueKey and the 2nd parameter is the new label text.

Code this endpoint to get the issue object using the IssueManager with issueKey and then use the LabelManager to add the new Label.

For your current endpoint that displays the dialog page with an input field and buttons. You can embed an AJAX call within the HTML it returns.

You use this AJAX call to talk to the new RestEndpoint and parse in the issueKey and the text that the user has entered into the input field.

You can use standard jQuery to get the value the user has entered.

You could process the input entered by the user within the rest endpoint to split on spaces if you wanted to add multiple labels with one submit.

Here is an example of an endpoint like your example but with an ajax call to another endpoint. It just adds one label to the issue based on what the user inputs.

Custom Dialog with Input field and Save Button:


When you create the web item that "Runs code and Display a Dialog" you would use a URL like this to parse in the parameters:


Example of the Endpoint that adds the single label:


The URL to parse the parameters to the above is shown in the first Rest Endpoints AJAX code.




Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events