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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

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,559,205
Community Members
 
Community Events
184
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

0 votes
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.
Jan 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 :)

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.
Jan 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.
Jan 22, 2021

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

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.
Jan 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.

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



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.
Jan 26, 2021

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

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.
Jan 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.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events