It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Send E-mail Notification after editing a specific custom field in issue edit screen

Hi there,

I've been looking around for a while and can't find a real solution. We have implemented a custom field called "supervisor" (user picker). As sonn as someone changes the value of that field (selects another supervisor) I need an e-mail sent to the new supervisor.

Those are the posts I've found so far:

As far as I can tell the problem is mainly being addressed via post-functions as part of the groovy script plugin.

The problem is, that I would need a transition to fire an event, a post-function etc. My customer wants the email to be sent right away without the need of a workflow transition. Would it be possible to execute the code provided in Jamies examples of the script runner using the behaviours plugin (in real time) ?

Thanks for any hints...

Cheers Christian

3 answers

1 accepted

1 vote
Answer accepted
JamieA Jul 05, 2012

I think you need to use the send email listener with a condition that the field has changed, and is the value you want to check for.

Using the behaviours plugin is all well and good, but it will send the mail as soon as the value is changed, and before the issue is even saved. I know they wanted it sent "as soon as" but that's overkill. If they toggle it multiple times then multiple emails will be sent.

Hey, thanks for the advice. I've never created a listener. Are those the right places I have to start from? Or can I modify an existing listener?



Jobin Kuruvilla [Go2Group] Community Leader Jul 05, 2012

Yup, those are the ones!

3 votes
Sandeep Kolte Mar 19, 2018

My solution to notify someone when a custom JIRA field is modified is to use the Filter and Subscriptions.

E.g. If I needed a notification sent out whenever our custom field ‘Test Notes’ is updated, I would create a filter such as says ‘Test Notes Updated in last 1 hour’ with following search criteria

 "Test Notes" is not EMPTY AND updated > -1h

 Next, save the filter. Search your saved filter in Manage Filters. Click Subscribe under Subscriptions column. Add subscription using the on screen options for Recipients, Schedule, Interval etc. If you need one or more people to receive the notifications, create a JIRA group under JIRA User Management options / Groups tab on the left. e.g. jira-testers: Once you add the subscription, that’s it, it is not instantaneous as you are asking it to notify everything updated in last one hour (1h in the filter above) but you can make it so if you want by changing your filter.


0 votes
Mizan Ali Sayed Jul 04, 2012

I think this is possible using Behaviours you will just need to paste the same script with some additional packages provided by behaviours plugin as a server side script on the "supervisor" field.

This script will get fired whenever the supervisor field is changed.

Note : it will even get fired if someone changes the field and again change the field and everytime when changing the field before submitting

Mizan Ali Sayed Jul 04, 2012
import com.onresolve.jira.groovy.user.FieldBehaviours
import com.onresolve.jira.groovy.user.FormField
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.Issue
import com.atlassian.mail.Email
import com.atlassian.mail.server.MailServerManager
import com.atlassian.mail.server.SMTPMailServer
import org.apache.log4j.Category

FormField supervisor = getFieldById(fieldChanged)
ComponentManager componentManager = ComponentManager.getInstance()
MailServerManager mailServerManager = componentManager.getMailServerManager()
SMTPMailServer mailServer = mailServerManager.getDefaultSMTPMailServer()
if (mailServer) {
        Email email = new Email("") // Set the TO address, optionally CC and BCC
        email.setSubject("Blocking issue raised by ${issue.getReporter().getFullName()}: ${issue.summary}") // todo: check the subject value
        String content = "Construct your body here.";  //TODO: Set email's body.
else {
    log.error("No SMTP mail server defined")

Try the above script , enable logging .

I'll try the script tomorrow. Thanks! Just one more thing:-) The Email TO-address in this example is static. I'd need to dynamically populate that with the newly selected supervisor's mail address. Any ideas?

Mizan Ali Sayed Jul 04, 2012

I dont think that will be a big challenge we will have to get the value in the supervisor field then get the email id of that user , first test with a static email id .

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Next-gen

Introducing subtasks for breaking down work in next-gen projects

Teams break work down in order to help simplify complex tasks. This is often done iteratively, with tasks being broken down into smaller tasks and so on until the work is accurately captured in well-...

9,227 views 28 42
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you