Groovy - fire an event based on type & reporter

GilK
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 11, 2012

Hi,

I'd like to fire an event based on two conditions:

1. the type of the issue (bug, story, epic, etc.)

2. the group that the reporter belongs to (jira-users, jira-developers, mine-managers, mine-qa-hw, etc.).

How do I achieve this?

Thanks,

Janiv.

1 answer

1 accepted

1 vote
Answer accepted
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 12, 2012
issue.issueTypeObject.name == "MyIssueType" &&
    ComponentManager.getInstance().getUserUtil().getGroupNamesForUser(issue.reporterId).contains("somegroup")

But if you allow anonymous creation of issues check you have a reporter, otherwise you'll may get an NPE.

GilK
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 29, 2012

Thanks,

Where do I put this code?

I have 8 groups and for each bug I'd to be send notification to the appropritae group (according to the component). How do I fire such an event?

Is there an easier way to send a notification to the group which the Component Leader is part of?

i.e. If QA open a bug (or other issue type) woth componenet Hardware, I want a notification mail will be sent to the group where the Hardware Leader belongs to.
Assuming the Component Leader assigned to multiple groups, is it still possible?

Thanks,

Janiv

JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 29, 2012

I'd just write a custom post-function and hardwire the mapping of components to groups. The component leader will always be a part of multiple groups, eg jira-users, so doing it programatically would be messy.

Suggest an answer

Log in or Sign up to answer