Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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 Apps & Integrations

🍂📹 Apptoberfest demo contest roundup: vote for your favorite demos!

Hi Community! The submissions are in (and listed below) for the 🍻🍂Apptoberfest🍂🍻 Demo Competition and it’s time for you to place your votes for the best: Analytics & reporting app demo ...

263 views 7 18
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