Versions Compared

Key

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

...

The following examples can be used in Issue, Ad-hoc and Post-function notifications:

Code Block
languagetext
##Use values from a given select custom field
#foreach ($item in $context.issue.fields.customfield_10265)
$recipientUtils.addEmailRecipients($item.value.asText())
#end

##If the event is an issue created event, notify a non-Jira email address
#if ($context.webhookEvent.textValue() == "jira:issue_created")
    $recipientUtils.addEmailRecipients("scripted@example.com")
#end

##If issue priority is blocker and type is bug, notify Jira user johnfixall
#if ($context.issue.fields.priority.name.textValue() == "Blocker" && $context.issue.fields.issuetype.name.textValue() == "Bug")
	$recipientUtils.addUserRecipients("557058:a8d85d49-2566-47f4-9f31-861930631857")
#end

##If issue is of project SD, notify email users devLead@mycompany.com and testLeader@mycompany.com
#if ($context.issue.fields.project.key.textValue() == "SD")
	$recipientUtils.addEmailRecipients("devLeader@mycompany.com,testLeader@mycompany.com")
#end

##If issue priority is Major, notify support level 3 group
#if ($context.issue.fields.priority.name.textValue() == "Major")
	$recipientUtils.addGroupRecipients("support-level-three")
#end

##If issue priority is Minor, notify support level 1 and level 2 groups
#if ($context.issue.fields.priority.name.textValue() == "Minor")
	$recipientUtils.addGroupRecipients("support-level-one,support-level-two")
#end

##If operation was made by CEO user or issue reporter's CEO user, notify management
#if ($context.user.key.textValue() == "ceo" || $context.issue.fields.reporter.key.textValue() == "ceo" )
	$recipientUtils.addGroupRecipients("management")
#end

...