Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
#if ($!recipientEmail && $recipientEmail.matches(".*@blah.com"))
  $jemhUtils.setInhibitSending(true)
  #set ($inhibitedMsg = "Recipient is inhibited: "+$recipientEmail )
  $jemhUtils.setInhibitSendingReason($inhibitedMsg)
#else
 .. the rest of the template, no point rendering
#end

Inhibiting by user group

JIRA 7+

JIRA 6.4


Code Block
#if($groupManager.isUserInGroup($recipientUser, "jira-administrators"))
  INHIBITED
  $jemhUtils.setInhibitSending(true)
  $jemhUtils.setInhibitSendingReason("Inhibiting notifiction to jira-administrators")
#end



Code Block
#if($groupManager.isUserInGroup($recipientUser.getDirectoryUser(), "jira-administrators"))
  INHIBITED
  $jemhUtils.setInhibitSending(true)
  $jemhUtils.setInhibitSendingReason("Inhibiting notifiction to jira-administrators")
#end


Inhibiting by user picker custom field

...

Once you've created the custom field, make a note of the ID on the Cog > Configure link, (hover, look at URL), it will be something like:

http://dev-jira:8080/secure/admin/ConfigureCustomField!default.jspa?customFieldId=11104

The Custom Field default value for interactive users:

...

Code Block
#if ($!issue.getCustomField("customfield_10100") && $!issue.getCustomFieldValue("customfield_10100")) 
    #if ($issue.getCustomFieldValue("customfield_10100")=="Email")
        $jemhUtils.setInhibitSending(true)
        $jemhUtils.setInhibitSendingReason("This notification was inhibited because the issue was created by email")
        <h3>Create by Email</h3>
    #else
        <h3>Created Interactively</h3> 
		... Your email template here
	#end
#end
Note

The method $!issue.getCustomField has been removed since Jira 8.19.0. Please use the following if using a later version. For more info see:

Code Block
#if ($!customFieldManager.getCustomFieldObject("customfield_10100") && $!issue.getCustomFieldValue("customfield_10100")) 
    #if ($issue.getCustomFieldValue("customfield_10100")=="Email")
        $jemhUtils.setInhibitSending(true)
        $jemhUtils.setInhibitSendingReason("This notification was inhibited because the issue was created by email")
        <h3>Create by Email</h3>
    #else
        <h3>Created Interactively</h3> 
		... Your email template here
	#end
#end


Note

Hintogram templates, and (as of 1.8.23) Forward templates can also take advantage of this notification inhibition script.  This could be useful if for example, you wanted to stop being notified of a certain error message.

...

Page Properties
hiddentrue


Related issues