Forums

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

How to send notification when Story is assigned to Epic

Matthew Ford May 17, 2018

I am not familiar with this scripting

Can someone help me with:

create a scriptrunner listener for an "issue created" event,

and in the listener
check if there is an "Epic-Story Link" type link, if yes
get the Epic linked to the issue
get the watchers of the Epic
send a mail to these watchers 

Unless you have an alternative solution.

 

1 answer

1 accepted

1 vote
Answer accepted
Roland Holban (Adaptavist)
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.
May 21, 2018 edited

There is currently a bug (https://productsupport.adaptavist.com/browse/SRJIRA-2690) with the "Send custom email" listener so this will not work correctly.

When the bug is fixed though, this is how you would accomplish your goal.

  • Create a "Send a custom email" listener and have it fire on IssueLinkCreatedEvent
  • Type "Watchers" in the "To issue fields" screen in order to send an email to all the watchers on that issue
  • For the condition script use:
def issue1 = event.getIssueLink().getSourceObject()
def issue2 = event.getIssueLink().getDestinationObject()

issue1.getIssueType().getName() == "Epic" && issue2.getIssueType().getName() == "Story" 

This will fire every time a new link is created between two issues, check if its a story linked to an epic, and if it is send an email to all the watchers. 

Matthew Ford May 21, 2018

Can you explain how to create Send custom email listener for Adaptivist?  I am not seeing that option.

Roland Holban (Adaptavist)
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.
May 22, 2018

Navigate to the Script Listeners page, click Add new item. The Send custom email option should be in the bottom right.

Screen Shot 2018-05-22 at 8.28.40 AM.png

Matthew Ford May 22, 2018

Thanks.  I see that option, but I am not able to find the event:  IssueLinkCreatedEvent

It is not showing in the Even list.

Roland Holban (Adaptavist)
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.
May 22, 2018

What version of JIRA and SR are you using?

Matthew Ford May 22, 2018

JIRA 7.3.3 and SR 5.3.26

I found RemoteIssueLinkCreateEvent

Roland Holban (Adaptavist)
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.
May 22, 2018

The IssueLinkCreatedEvent got added in JIRA 7.5. You would need to upgrade if you want to use it.

Matthew Ford May 22, 2018

Thanks. I will work on doing that.

Matthew Ford January 14, 2019

Getting this error:

Time (on server): Mon Jan 14 2019 11:57:40 GMT-0500 (Eastern Standard Time)

The following log information was produced by this execution. Use statements like:log.info("...") to record logging information.

2019-01-14 16:57:40,514 ERROR [runner.AbstractScriptListener]: *************************************************************************************
2019-01-14 16:57:40,514 ERROR [runner.AbstractScriptListener]: Script function failed on event: com.atlassian.jira.event.issue.link.IssueLinkCreatedEvent, script: com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.SendCustomEmail
java.lang.IllegalArgumentException: The issue object was not available in the binding, perhaps called from an event handler with a non-issue event
 at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.SendCustomEmail.doScript(SendCustomEmail.groovy:517)

Matthew Ford January 17, 2019

The script is not working.  Any suggestions?

Matthew Ford January 30, 2019

The solution provided is not working.  It is marked as Accepted Answer, but it is not working.  Please assist.

Matthew Ford February 7, 2019

Can someone help?

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, atlassian government cloud, fedramp, webinar, register for webinar, atlassian cloud webinar, fedramp moderate offering, work faster with cloud

Unlocking the future with Atlassian Government Cloud ☁️

Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.

Register Now
AUG Leaders

Atlassian Community Events