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

scriptrunner how to get user input for web item

Noam Twena
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 13, 2023

I already created a web item button.

I already created a REST endpoint to make my groovy code work when I click the button.


What I need is  - get user input for my groovy code. (I guess it is done with JS in web resources but I'm not sure how)

Is this possible?




2 answers

0 votes
Graham Twine
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 14, 2023

Hello @Noam Twena

May I please firstly confirm by web item you do mean this?

Further more, what is "Your Groovy Code"?

Is it a Scriptrunner REST endpoint that accepts some query parameters?

What section have you placed this on?

What is the button? By this I mean is it a <button /> or is it an anchor with css button classes?

Is the file that contains the button a velocity template?


If I am understanding you correctly then may I propose the following.

1. If you are using a button, it may be easier to use an anchor with an Ajax call to your custom rest endpoint. If you use a button then the href property will not do strange things when clicked. Consider which suites your use case better.

2. Bind a javascript function that contains the Ajax call in the On init function(Document ready) is the button in the DOM when the page loads?


What happens if I spam click the button? (Debounce / disable / remove) the element on click and a successful Ajax response.


What is the response going to do to the page? Add some stuff / nothing only a 200 response is needed to confirm a successful call.


Have you looked at AUI, this is useful for DC and server as well.

If you use velocity will the file just contain the javascript?

If not it will need to be registered as a downloadable resource in the plugin.xml

Is this even a custom plugin?



0 votes
Fabio Racobaldo _Herzum_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 14, 2023

Hi @Noam Twena  and welcome,

in order to retrieve information about logged in user you could try the following code :

import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.user.ApplicationUser;

ApplicationUser loggedInUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser();

Hope this helps,


Suggest an answer

Log in or Sign up to answer