Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

can we create a small message window using html or javascript in listener event in scriptrunner?

ss
Contributor
January 30, 2021

Hi,

I am using ProjectRoleUpdatedEvent from listeners in scriptrunner. 

After doing my work I want to pop-up a message window with some relevant information for the user. 

Unfortunately, 

import com.onresolve.scriptrunner.runner.util.UserMessageUtil

UserMessageUtil.info("Something")

is not working for me, as it has some context issue when used in projectroleupdatedevent. And, this has been confirmed and accepted by AdaptaVist when I contacted them. They have even registered it as a bug. 

So I am seeking help here. 

Is is possible to write html or javascript within groovy code that can help to pop-up a simple window message with some information and just an OK button?

regards

 

 

1 answer

0 votes
PD Sheehan
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.
February 8, 2021

I don't think this is possible to do.

Fundamentally, the whole purpose of a listener is to perform some task at the server-level in an asynchronous fashion relative to the action that triggered the event in the first place. 

That action may or may not be associated with a user's action in the browser.

There is no good way to initiate a message from the server-side. The browser has to initiate all requests.

My understanding of the UserMessageUtil implementation is only on workflow transitions. And not even all workflow transitions: JSD approvals are not able to trigger messages.

What seems to happen is that after the transition is performed on the screen, there is a javascript event that calls a scriptrunner endpoint (watch for rest/scriptrunner/1.0/message in your network traffic). That endpoint somehow has a way to keep pending messages available for a specific browser session and when the request is made it responds with the flag data which the browser javascript handles and displays. 

You would need to re-implement that mechanism, but then, what should trigger that message lookup from the user's front-end? How quickly after the user's update should it look for it?

Another approach would be to bypass the default action altogether and write some javascript that would call a custom

Suggest an answer

Log in or Sign up to answer