Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Conditional Email Will Send if Custom Field is in Group

Luis Laurenzo Dapat June 5, 2019

Hello,

I don't know how to set a condition where an email will only send if the recipient belongs to a specific group.

I'm trying to add a condition within the post-function that sends an email after a transition. The condition is that the custom field--which identifies a person (not an assignee or reporter) with a specific role in the issue--should belong to a specific group in order for the email to be sent. 

Here is the code that I typed:

issue.get("project")?.name == ("Testing") && issue.getAsString("customfield_10110") in xyz Group.

I basically don't know what should follow after identifying the customfield that I want to check.

I'm using the Update parameters of the Email issue (JMWE add-on) Function for this transition

1 answer

1 accepted

0 votes
Answer accepted
Radhika Vijji _Innovalog_
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.
June 5, 2019

Hi Luis,

JMWE app has a Groovy editor help in the post-function configuration that helps you in writing your Groovy scripts. For example, to check that the issue belongs to a specific project, in the editor help click on "Issue Fields", select "Project" and the help will show you some useful examples. 

You should modify your code to this:

issue.get("project").name == "Testing" && ComponentAccessor.groupManager.isUserInGroup(issue.get("customfield_10110"), "xyz")

 

Regards,

Radhika

Luis Laurenzo Dapat June 11, 2019

Hi Radhika,

Thank you for your response. It works now!

Regards,

Luis

Suggest an answer

Log in or Sign up to answer