Forums

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

Determine a trigger event for Scriptrunner Listener.

Brian Swackhamer July 8, 2022

I am using scriptrunner to send a custom email based on a value in a custom multi-select field that will send to various folks based on their roles and the value(s) selected.  The issue that I have is that I want to customize the notifications to tell the people that receive the emails what event happened that caused the email to trigger.

I am attempting to use a single listener to accomplish this and then modify the subject line based on the triggering event.  I have Issue Created, Issue Update, Issue Assigned, Issue Commented, etc in my listener.

So, to the skinny of the situation, can I do this? or do I need to copy my code over and over for each event?

 

1 answer

1 accepted

0 votes
Answer accepted
Florian Bonniec
Community Champion
July 9, 2022

Hi you should be able to get the event type.

https://docs.atlassian.com/software/jira/docs/api/7.6.1/com/atlassian/jira/event/issue/IssueEvent.html#getEventTypeId--

 

long EventId= event.getEventTypeId()

 

Then in your script you can have a mapping between the event type id and the name you want to return to be more user friendly.

You can find event.id <> name in the event page from system admin menu.

Brian Swackhamer July 11, 2022

Thank you....I cloud not find the getEventTypeID() prior to your response.  Very helpful.

Suggest an answer

Log in or Sign up to answer