Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,299,230
Community Members
 
Community Events
165
Community Groups

Sending email in post-function by scriptrunner does not accept condition

Edited

Configured sending of e-mail in post-function configured the condition for sending the scriptrunner did not accept and send the e-mail for all issues even the condition without errors.

In the three tests the email was sent skipping the condition as if it did not exist.

First test - issue.reporter == 'Cybersecurity.telefonica'

Second test - issue.reporter? .name == 'Cybersecurity.telefonica'

Third test - cfValues ​​['Grupo Solucionador'] == 'SegurancaInformacao_BM'

I need an email to be sent when

issue.report = 'Cybersecurity.telefonica' and Grupo Solucionador = 'SegurancaInformacao_BM'

 

 

2 answers

Hi @Linton Tomaz da Silva ,

issue.reporter method is returning an ApplicationUser value so the comparison with String value might not be working.

Please try this way and I can confirm is working on my side:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.ApplicationUser

def userManager = ComponentAccessor.userManager

ApplicationUser user = userManager.getUserByName("Cybersecurity.telefonica")

user == issue.reporter

 I hope this helps :)

Hi @John Chin 

The scriptrunner continues to send e-mail in all situations, the condition is ignored, I need the e-mail to be sent only when reporter == 'Cybersecurity.telefonica', did not work.

As I mentioned, please use this script on the scriptrunner condition:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.ApplicationUser

def userManager = ComponentAccessor.userManager

ApplicationUser user = userManager.getUserByName("Cybersecurity.telefonica")

user == issue.reporter

Hi @Linton Tomaz da Silva can you share screenshot of your configuration pls?

Thank you for the screenshots... it looks good so far. What if you press "preview"? What is the result? There should be information about condition and if it was true or false.

Hi, when clicking on preview the displayed message is correct, see



@Linton Tomaz da Silva it looks like attachment/screenshot was not uploaded.

Ok, are you sure you Published your workflow? It is not enought to Save the postfunction's configuration. You also need to publish the workflow.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Confluence

An update on Confluence Cloud customer feedback – June 2022

Hi everyone, We’re always looking at how to improve Confluence and customer feedback plays an important role in making sure we're investing in the areas that will bring the most value to the most c...

260 views 2 5
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you