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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Class name field in mygroovy script listener

Good day,

 

I am learning how to write scripts and run them with mygroovy in Jira Software Server.

If I understand right, class name means listener class.

Question - what should I write if I want in script to handle with multiple event types?  

com.atlassian.jira.event.project.VersionCreateEvent
com.atlassian.jira.event.project.VersionReleaseEvent
com.atlassian.jira.event.project.VersionUpdatedEvent
com.atlassian.jira.event.project.VersionDeleteEvent
com.atlassian.jira.event.project.VersionArchiveEvent
com.atlassian.jira.event.project.VersionMergeEvent
com.atlassian.jira.event.project.VersionUnreleaseEvent
com.atlassian.jira.event.project.VersionUnarchiveEvent

with code like

if (event instanceof VersionCreateEvent){
def event = event as VersionCreateEvent
log.debug "new version created"
}
else if(event instanceof VersionUpdatedEvent){
def event = event as VersionUpdatedEvent
log.debug "version was updated"
}

Or it is not possible and should devide scripts on different event types?

image.png

1 answer

1 accepted

0 votes
Answer accepted

Oh, I found answer my self.

I need to choose parent class. Parent class in this case is "com.atlassian.jira.event.project.AbstractVersionEvent"

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Apps & Integrations

🍻🍂Apptoberfest Update: Upcoming Virtual Events 🎉

Hello Community! I hope you've been enjoying the 🍂Apptoberfestivities🍂 (I know I have!) The event is heating up next week with a series of virtual events that we're calling the 🍻🍂Partner App ...

101 views 1 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you