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



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
Community showcase
Published Nov 29, 2018 in Marketplace Apps

How to set up an incident workflow from the VP of Engineering at Sentry

Hey Atlassian community, I help lead engineering at Sentry, an open-source error-tracking and monitoring tool that integrates with Jira. We started using Jira Software Cloud internally last year, a...

1,717 views 3 11
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