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,464,893
Community Members
 
Community Events
176
Community Groups

Use some code in both a listener and a scheduled job

Hi,

I have written a script in a listener which gets some properties from an issues and adds them up. The sum is stored in another field. The listener currently works on the events "Issue Created" and "Issue Updated".

The logic in the script might change at some point and I would like to then run the script on all issues within a project.

Where do I place my code so that I can use it in a listener as well as e.g. in the console or in a scheduled job? I placed a groovy file into the script editor and the file now contains a groovy class "MyClass" in a package like "my.package".

Is there any change I can access this class in a listener using in import such as "import my.package.MyClass", create an instance and run a method passing in the issue from the listener event?

Thanks,
   Tobias.

 

1 answer

1 accepted

0 votes
Answer accepted

Mmh. I might have made some mistake, but it seems to work now. I was able to import my class on the "Console", instantiate it and run a method on it. Sorry for the noise.

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events