Is it possible to send mail to only watchers group when custom field updated to "Red_Flag"?

Is it possible  to send mail to only watchers group when custom field updated to "Red_Flag"?

I have already installed script runner plugin but I can't find the suitable built-in scripts.

Thanks for your great support.

1 answer

0 votes
Joshua Yamdogo Community Champion Aug 24, 2017

You should be able to do this fairly easily. You could set up a script listener that responds to "Issue Updated" events. In the condition of that script listener, check to see if the custom field value is "Red_Flag":

import com.atlassian.jira.component.ComponentAccessor

// get the Custom Field Manager
def customFieldManager = ComponentAccessor.getCustomFieldManager()

// get a Custom Field Object
def textCf = customFieldManager.getCustomFieldObjectByName("Name of your field here")

// check custom field value, returns true if value is found
issue.getCustomFieldValue(textCf) == "Red_Flag"

Remember to change the script and put in your custom field name.

If the custom field value is "Red_Flag" the condition will return true and a custom email will send. You can set the "To issue fields" to the "Watchers" group so that it goes to the Watchers only.

Screen Shot 2017-08-24 at 9.58.12 AM.png

#1.If my customfiled type is multiple select list and then use the floowing code to place in custom field description:

<script type="text/javascript">

AJS.$("#customfield_11903 option[value='-1']").remove();

new AJS.MultiSelect(
element: $("#customfield_11903"), itemAttrDisplayed: "label", errorMessage: AJS.params.multiselectComponentsError



to convert to components filed type.

But I don't wnat to remove "None" from the multiple select lists.

How can I revise the code?

#2.My multiple select list should have option:

None,Red_Flag,Blue_Flag and White_Flag

and then use this built-in scripts to judge

if Trigger(customfield name) contain 

Red_Flag or Blue_Flag or White_Flag then send to watchers.


Do you have any suggestions ? Thanks for your great support!

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,755 views 11 18
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot