In this example we will create a new Dialog inside Jira using Scriptrunner, a little bit of HTML, Groovy and Javascript.

First we will create 2 REST Endpoints (one to show the Dialog and another one to show a HTML page with the results of the action).

Custom REST EndPoint: showDialogExample (example code extracted from this link)

Note in this example of Dialog XML in the “form” tag there is an “action” attribute to send the params by URL to the next Jira custom REST endpoint.

Custom REST Endpoint: showDialogExampleResult

Note in this example we use queryParams.getFirst() method to obtain the params. As result we will show an HTML full page with a response text with all the params collected.

Let’s create the last part (the Web Fragment to show a button in the Issue in order to call the new Dialog REST Endpoint)

Ok that’s all! In summary we have 2 REST Endpoints and 1 Fragment.

Ok! Let’s do a test! Go to some Issue of your Jira system

Click in More button –> Dialog Test MrAddon

And just click “Confirm”! Now we will see the values selected in the new response page. Easy!

By MrAddon

.

Posted by:.

3 replies on “Example of Dialogs with Jira and Scriptrunner

  1. Hello Mr. Addon,

    I am in a dire need of creating a pop-up message box from ProjectRoleUpdatedEvent listener script.
    My script runs whenever role is modified in any project. That code is working successfully.
    But after that part is done, i want to show a message box. Unfortunately, import com.onresolve.scriptrunner.runner.util.UserMessageUtil does not work as there is bug which adaptavist has confirmed. This method only works for issue based events.
    So my question to you is the solution that you have presented on this blog to show a dialogue box using fragments, can this be used in listener script also? and how?
    I just want to show a message box with an OK button.
    please help if you can.
    regards
    ss

    Like

    1. Hello,
      In a Script Listener you do not have the UI context, for this reason is not possible to show the message (the question is.. to who is the message?). In my opinion the script listener must create a notification (email) or a slack communication. Best regards

      Like

  2. warning: this no longer works in newer Jira versions. Went from 8.0.2 to 8.15.0 and dialogs will no longer pop up. Screen grays, but no dialog. I’m hoping Adaptavist can figure it out.

    Like

Leave a Reply to Bob Cancel reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s