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

This widget could not be displayed.



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 Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Published Monday in Marketplace Apps

The 7 hacks of highly successful automation

...there's anything I've learnt from working, it's that people are lazy! No offense to anyone reading this, but it's true and we can all admit it. The easier you make something for someone, the more...

336 views 0 13
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