Versions Compared

Key

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

...

From version 1.7.2, JEMH has the ability to allow scripted decision logic at the Template level on whether or not a given notification should be sent by using the $jemhUtils.setInhibitSending(boolean) method.  The script itself can be as simple or complex as you need.

/wiki/spaces/JEMH/pages/2850840 are the raw Velocity mark-up content for email notifications.  For more information on what Velocity is and how it is used, see the official user guide here.

Project Mapping Solution

If you do not want to customize templates, it is possible to add inhibition logic at the ProjectMapping config level, see:

The Velocity Context

The usual velocity context references are available to help you script your decision logic, there is also a helper class available $jemhUtils , see the API link below for additional methods available:

...

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

...

Page Properties
hiddentrue


Related issues