Get notification only from priority change

Rumceisz June 24, 2012

Hi All,

one of my project lead asked for getting email notifcations when a user change the priority on an issue in his project.

Now only the Current assignees get email from Issue Updated event.

I know that we can just add the project lead to the Issue Updated event but can it be made that he gets email ONLY about changing the Priority fields? So other updates (e.g. custom fields, etc.) would not trigger email for him?

Can it be done?

Thanks!

Rumi

1 answer

1 accepted

0 votes
Answer accepted
Mizan
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.
June 24, 2012

This can be done by a listener , you will have to create a listener( plugin) which will check the change in an issue, if the priority has changed then it will trigger an event then based on this even send an email to the project lead .

There is a similar script available with the script runner plugin but it sends email on some condition .

Mizan
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.
June 24, 2012

try adding condition for project too . i dont know the correct sysntax but something like

issue.project?.name=='ABC'

Rumceisz June 24, 2012

Hi Mizan,

yes, I found the built-in script "Send a custom email" but here cannot be restrict the project:

issue.priority?.name == 'Major' && changeItems.any {
	it.get('field')=='priority'
}

It would trigger emails from all the 200 projects we have.

Rumceisz June 24, 2012

Thank you!

I instered an email template:

#parse("templates/email/includes/issueplugins.vm")
     [ ${baseurl}/browse/${issue.getKey()}?page=${tabpanel-all} ]

#if($remoteUser.fullName)
$i18n.getText("template.change.updated", $remoteUser.fullName, $issue.getKey())
#dashes($!remoteUser.fullName)---------#dashes(${issue.getKey()})-
#end

#changesIncludingStatus([])
#comment()
#visibility()

#parse("templates/email/text/includes/issuesummary.vm")

#parse("templates/email/text/includes/footer.vm")

When I made a preview, I got the following error message: groovy.lang.GroovyRuntimeException: Failed to parse template script (your template may contain an error or be trying to use expressions not currently supported): startup failed: GStringTemplateScript4.groovy: 6: illegal string body character after dollar sign; solution: either escape a literal dollar sign "\$5" or bracket the value expression "${5}" @ line 6, column 73. $remoteUser.fullName, $issue.getKey()) ^ 1 error

What I don't understand because I don't really know this scripting.

Mizan
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.
June 24, 2012

Where have you inserted this template ? It is very different from the template shown in the docs

Jozef Kotlár
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.
June 24, 2012

You are mixing things: that code you pasted is velocity template, GStringTemplate is other beast, as explained in http://groovy.codehaus.org/Groovy+Templates

Suggest an answer

Log in or Sign up to answer