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

Use some code in both a listener and a scheduled job

Tobias Wolff December 3, 2022

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

Suggest an answer

Log in or Sign up to answer
0 votes
Answer accepted
Tobias Wolff December 3, 2022

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.

TAGS
AUG Leaders

Atlassian Community Events