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

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

Linton Tomaz da Silva January 22, 2021

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

Suggest an answer

Log in or Sign up to answer
1 vote
John Chin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 24, 2021

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 :)

Linton Tomaz da Silva January 26, 2021

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.

John Chin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 26, 2021

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
0 votes
Martin Bayer _MoroSystems_ s_r_o__
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 22, 2021

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

Linton Tomaz da Silva January 26, 2021

Hi @Martin Bayer _MoroSystems_ s_r_o__  follow the captured screens.image.pngimage.pngimage.png

Martin Bayer _MoroSystems_ s_r_o__
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 26, 2021

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.

Linton Tomaz da Silva January 26, 2021

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



Linton Tomaz da Silva January 26, 2021

.

Martin Bayer _MoroSystems_ s_r_o__
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 26, 2021

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

Linton Tomaz da Silva January 26, 2021

this is the imagimage.png

Martin Bayer _MoroSystems_ s_r_o__
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 26, 2021

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.

TAGS
AUG Leaders

Atlassian Community Events