Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

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

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

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!

Leaderboard

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
4,553,430
Community Members
 
Community Events
184
Community Groups

Script fragments : how to run custom groovy code using web-item ?

Antoine Berry
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Jan 09, 2018

Hi,

I want to run some actions while triggering a custom button (web-item most likely), like udpating a custom field value or triggering an event. Is it possible to bind a groovy script to that button ?

I have not seen an example of this, so I guess it is not possible, but I wanted to give it a try.

Regards,

Antoine

2 answers

1 accepted

0 votes
Answer accepted
Alexey Matveev
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.
Jan 09, 2018

Hello,

You need to create a REST end point and then call the rest end from your web item.

Antoine Berry
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Jan 10, 2018

Hi Alexey, thanks for your answer.

I have made my script work. Only one thing is missing. I am using a web-item in the operations-top-level section. How to make the section disappear when I click the button ? I want the user to click the button exactly once.

Regards,

Antoine

Alexey Matveev
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.
Jan 10, 2018

Add a web resource with javascript. Attach to the web item click event and hide the web item on click. You can read more here

https://scriptrunner.adaptavist.com/4.3.9/jira/fragments/WebResource.html#_hiding_menu_button_using_javascript

Antoine Berry
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Jan 11, 2018

Thanks, I am almost there.

I successfully hid the button on click. However I would like the drop-down menu (More ...) to close after I click the button, while still having the button available if the user clicks again on More

Is that possible ? I could not find any documentation on that (and I am new to javascript).

Thanks,

Antoine

Alexey Matveev
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.
Jan 11, 2018

I have never tried it. 

Hi @Antoine Berry I think you are running a script on button click. Can I know how did you do that ?

Antoine Berry
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Aug 08, 2018

Hi,

I abandoned this solution. If I remember correctly, you need to create a REST end point (GG > Rest Endpoint) and then create a script fragment that runs this service (GG > Script fragments).

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events