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

Getting an Event Name via Groovy

I am putting all Events into splunk:

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

Incuding the EventTypeId. But I cant get a hand on the Name itself like "Issue Created" - only by hardcoding it with if/case like:

 

if (EventId == EventType.ISSUE_WORKLOG_DELETED_ID)
{
EventName="Worklog Deleted"
}
if (EventId == EventType.ISSUE_WORKLOG_UPDATED_ID)
{
EventName="Worklog Updated"
}

How do I get hold of the name (also for Custom Events):

if (EventId == 10009)
{
EventName="P1 Incident"
}
if (EventId == 10010)
{
EventName="P2 Incident"
}

 

1 answer

1 accepted

1 vote
Answer accepted

Hi

I think you could get them from EventTypeManager, see code:

 

import com.atlassian.jira.event.type.EventType
import com.atlassian.jira.event.type.EventTypeManager
import com.atlassian.jira.component.ComponentAccessor
EventTypeManager etm = ComponentAccessor.getEventTypeManager();

Collection<EventType> alleventTypes = etm.getEventTypes()

def result="";
for (EventType ev : alleventTypes) {
result+=ev.toString()+"<br>";

}

return result;

Suggest an answer

Log in or Sign up to answer
TAGS

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