Pop up message after handling event (java)

Christian_Schönert June 17, 2019

Hello,

 

I am currently handling the issue updated event on the java server side of jira. From there on I am passing the updated values to a different system. This communication between Jira and the other system is fairly simple realized through rest calls.

 @EventListener
public void onIssueEvent(IssueEvent issueEvent) {
// pass on data to different system
}

 

What I am searching now, is by idea also easy. After I passed the data on, I want to pop up a notification in Jira about the return status of the data pass. For example: "Successfully sent".

Problem is, it's actually not that easy. In my research I found out a few things:

  • https://docs.atlassian.com/aui/7.9.3/docs/messages.html Messages in AUI provide the type of notification that I'd like to have
  • AUI functionality can (afaik) only be accessed from velocities or javascript
  • It is possible to make custom events, although it's not quite clear to me how

 

So either I could pop a message from the onIssueEvent method somehow, or I create a custom event and raise it in onIssueEvent and catch it in a javascript. For both parts I don't really know how to do it. If you know how to manage it over a custom event, could you give a simple example (Event-Class, raise event, catch event jscript)? Of course the event would need to carry a tiny bit of information about the sending status.

I might not be seeing a different solution right now, so I am grateful for any kind of help in that direction.

 

Kind regards

Chris

1 answer

1 vote
Ilya Turov
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.
June 17, 2019

there's UserMessageUtil class which can help you generate three kinds of default jira popups: 

https://jamieechlin.atlassian.net/wiki/spaces/GRV/pages/36929563/Providing+feedback+from+scripts

Christian_Schönert June 17, 2019

Thank you.

That sounds very much like a solution I need. On Jira I am running Adaptavist Scriptrunner for Jira with Version 4.3.15.

Although I am not sure how to include the dependency right, since this:

<dependency>
<groupId>com.adaptavist.pom</groupId>
<artifactId>scriptrunner-jira-standard</artifactId>
<version>4.3.15</version>
<type>provided</type>
</dependency>

is not working. Though I think an independent solution would be much better, I'll take this if you could point me to how to include the dependency correctly.

Ilya Turov
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.
June 17, 2019

It totally slipped my mind that it's scriptrunner's feature, so I don't really know how to use it anywhere besides jira.

But since you already have it (scriptrunner) why not use it's own listeners?

Christian_Schönert June 17, 2019

Ok so I guess you need to put in a script for the event. So far I have never used Scriptrunner myself, since it was used by other developers for minor scripts. I didn't see at first that your link is only to write scripts with that plugin. I'm really looking for a solution that integrates into my plugin java code.

The thing is, that I already finished all the work with listeners, data transaction etc.

The only thing missing is a notification for the user, if something went wrong. But still your hint does help, as it may provide a (more costly) backup plan.

Suggest an answer

Log in or Sign up to answer