Yes, your button will have to be linked to a scriptrunner custom REST endpoint and that endpoint will run your code.
The easiest option is to select "run code and show a flag" in your web item fragment, then your rest endpoint just has to return a flag map to show the result of running your script.
Of course, you could always create your own javascript to react to the button click and call your rest endpoint.
Hey thanks for your answer, but I'm new to jira and script runner. Can you please explain how to link the button to an endpoint and run the code?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There are some examples here: https://docs.adaptavist.com/sr4js/6.24.0/features/script-fragments/custom-fragments/web-item
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I came across another scenario. Will I be able to access the input I give in the text box while running the script?
For example: let's say I have a text box and a button. I need to display the information entered into the text box while clicking the button.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you're looking to provide input to your REST endpoint and your script, then you will have to follow some of the instructions in that adaptavist documentation page under Dialogs (Advanced) section.
Your dialog will include the form and input field you want the users to fill in. The form button will have to have some javascript to call your rest endpoint and include the user's input.
But if you are dealing with a jira issue, it might be easier to have a transition (from any status to itself) and a transition screen provide you the form and the post function to execute your script.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.