The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

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

Defining a class to be used in groovy scripts

Siavosh Kasravi
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 Champions.
October 11, 2020

Is there a way to define a groovy class somewhere and import it when needed in a groovy script in ScriptRunner for example?

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Answer accepted
Raziman Dom - Ricksoft
Community Champion
October 12, 2020

Yup, you can do that.

Create a new class using ScriptRunner Script Editor

Screenshot 2020-10-13 at 12.48.17 AM.png

Then you can call it on Script Console:

Screenshot 2020-10-13 at 12.46.14 AM.png

If you created the script in a new folder, please make sure to follow this guide to import the class.