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
.
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
LikeLike
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
LikeLike
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.
LikeLike
Hello,
firstly, great job, that helped me a lot.
Also I am having a question. Is there any way to put submit button to footer to be working? If I have it in content part it is working well but if I move the button to footer no action happens.
I would love to have it working in footer next to Close button.
Thank you very much.
Best regards,
David
LikeLike
Hello David,
You can use a little bit of Javascript to achieve your goal
Create a link in the footer that calls the javascript function to call the form submit
Best regards!
LikeLike