Forums

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

Scriptrunner Listener on epic link

Mickaël Orsolino
Contributor
April 10, 2020

Hi,

I would like to get a listener on the issue without epic link.

I don't find the way to find the epic link class.

Could you help me?

Thank you for your help.

Regards,

Mickael

1 answer

1 accepted

0 votes
Answer accepted
SITTER Adrien
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.
April 10, 2020

Hello @Mickaël Orsolino

I am not sure of what you are asking.

If you have a Listener on an IssueEvent you will have an acces to the issue created, updated, assigned, revolved etc...

From there you can retrieve the Epic Link value this way:

import com.atlassian.jira.component.ComponentAccessor


def issue = event.issue


def customFieldManager = ComponentAccessor.customFieldManager

def epicLinkField = ComponentAccessor.customFieldManager.getCustomFieldObjectsByName('Epic Link')[0];
def epicLinkValue = issue.getCustomFieldValue(epicLinkField)

if (!epicLinkValue)
{
// Do something with issue which has no Epic Link
}
else
{
// Do something with issue which has an Epic Link

//For exemple retrieve Epic issue
def epicIssue = issueManager.getIssueObject((String)epicLinkValue)
}

 

Regards,

 

Adrien

Mickaël Orsolino
Contributor
April 10, 2020

Hi Adrien,

 

I try to catch each issue created without epic link. I will try your answer.

 

Thank you for your help.

 

Regards,

Mickael

SITTER Adrien
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.
April 10, 2020

Then you should just the code I posted with a Listener on event IssueCreated

 

Regards,

Adrien

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events