Hi all,
For one of the requirements that we have at the moment , custom listener from the script runner will be an option
The following listener that I used , is working fine .However email notifications are not sent for any updates.
Custom Listener on script runner.JPG
void issueUpdated(IssueEvent event)
{
try
{
Issue issue = event.getIssue()
if (issue.getIssueType()== "EPIC" )
{
List changeItems = event.getChangeLog().getRelated("changeItem")
if( changeItems.any {it.get('field')=='Fix Version/s'} )
{
def projectManager = issue.getProjectObject().getProjectLead().emailAddress
Email email = new Email( projectManager )
email.setSubject("Ticket ${issue.getParentObject()} Requires Review")
email.setBody("The Fix Version is updated recently for the issue $issue")
email.setMimeType("text/html")
SingleMailQueueItem item = new SingleMailQueueItem(email)
try {
ComponentAccessor.getMailQueue().addItem(item);
} catch (Exception e) {
log.warn("ERROR SENDING TICKET WATCHER EMAIL", e);
}
}
}
}
Hi RP,
Assuming you are using the latest version of ScriptRunner you could configure a built-in script listener called "Send a custom email" (rather than write your own).
To configure it:
import com.atlassian.jira.component.ComponentAccessor issue.issueType.name == 'Epic' && changeItems.any { ComponentAccessor.fieldManager.getOrderableField("fixVersions") }
The Issue $issue has changed it's FixVersion field to: ${issue.fixVersions}
Ticket $issue - requires review
I hope that helps.
Mark.
Thank you very much Mark
custom email template worked perfectly.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Excellent, thanks for letting me know.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Is there a good way to actually send custom emails using custom piece of scripted code? I'd prefer to have my code versioned inside any source control system and to deploy it to production JIRA using CI environment as opposed to having simple JIRA 'send custom email' configuration. There is no way of keeping track of changes to this configuration as long as it has to be manually filled in by human on the JIRA admin pages.
In my case I also need to diversify recipient list based on the actual project. For that purpose custom script listener looks like the best and only option I have.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
From the payload , the message is
"event": "com.atlassian.jira.event.issue.IssueEvent@7f313b61[issue=DPDK-48,comment=<null>,worklog=<null>,changelog=[GenericEntity:ChangeGroup][issue,15510][author,jadmin][created,2016-07-31 19:33:41.958][id,19945],eventTypeId=2,sendMail=true,params={eventsource=action, baseurl=http://testtriangle-atlassiansupport.com:8081/jira},subtasksUpdated=true]", "clazz": "{null/empty} (java.lang.String)", "bundle": "com.atlassian.jira.event.issue.DefaultIssueEventBundle@5225d86e", "events": "[2, 10200, com.atlassian.jira.issue.fields.event.FixVersionCreatedInline] (java.util.ArrayList)" }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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 NowOnline forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.