Send email with ScriptRunner post function not evaluating to true


We've just begun evaluating ScriptRunner with our Jira 7.3.0 instance. We want to send a custom email when an issue is created and contains 'Sev 1' or 'Sev 2' in the 'Severity' field. 

We've setup the post-function w/ScriptRunner's built in script, and every time we use the Preview function, it evaluates to "false" even though the key issue we're previewing with has 'Sev 2' as the value for the 'Severity' field. 

This is the Condition block of the ScriptRunner integration: == 'Incident'
cfValues['Severity'] == ['Sev 1', 'Sev 2']

This is the Body Text:

Dear ${issue.reporter?.displayName},

The ${} ${issue.key} $issue.summary classified as ${cfValues['Severity']} requires your attention.

Description: $issue.description

Status: $ 

When hitting the preview button, the body text pulls in all of the correct values. What I don't understand is why the condition consistently evaluates to false. When I create a new issue with a Severity value of Sev 1 or Sev 2, the email is never generated/received.

1 answer

0 vote



cfValues['Severity']?.value in ['Sev 1', 'Sev 2']


The first line will have no effect whatsoever, you need to && it with the second line if that's your intention: == 'Incident' &&
  cfValues['Severity']?.value in ['Sev 1', 'Sev 2']


Thanks for the quick reply. Updating the script to what you provided resulted in the Preview functionality evaluating the condition to true. So that's the good news!

The bad news is that my custom email was never sent/received. 

In the Post Function tab, the green checkmark appears with the date/time stamp of the creation of my test item.

Here are my 3 Post Functions for this transition:

  1. Creates the issue orignally.
  2. Fire a Issue Created event that can be processesd by the listeners.
  3. ScriptRunner workflow function - Send a custom email (condition apply). 


Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published Apr 10, 2018 in Marketplace Apps

Learn about how Stefan K. built one of the *first ever* Marketplace apps

In this post you will discover more about the evolution of K15t software, some big topics they're currently focusing on in the app space, and a rare (not not funny!) photo of founders Mike Cannon-Bro...

12,333 views 11 24
Read article

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