Script runner - conditions in custom email

Hi,

I'm using JIRA 6.3.7 and Script Runner 3.0.6.

I would like to create a script that send a custom email when a ticket with a specific label is created.
So, it seems that the "send a custom email" script listener is made for this. But I fail in filling the conditions so that the email is sent only when the label is there.

What is the correct syntax for labels please?

labels in ("mylabel")

 

In this listener, i entered the project key, the action (ticket created), email template and subject.

With this, i don't receive anything, with or without "mylabel" as label in the ticket.
Should I add something?

I previously tried with no condition, it works. I tried with "labels : 'mylabel' " and i received an email for every ticket^^.

 

Thanks smile

Vincent

1 answer

Hi Vincent, 

You're entering JQL for your condition, you nee to write it in groovy.

 

Something along the lines of this should work

issue.getLabels().contains('mylabel')

Eric

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,825 views 12 18
Join discussion

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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot