Forums

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

JMWE conditional execution - don't execute if creator is in this group

Andrew Januszak
Contributor
November 27, 2018

Hello, 

My post-function is supposed to run only if my "Reported on behalf of" field is blank and the creator of the issue is NOT in my "team-student-consultants" group. 

The conditional execution isn't working...and I'm almost positive it has to do with my syntax after the two pipes. Here is my unsuccessful groovy script: 

issue.get("Reported on behalf of")!= null || ! ComponentAccessor.getGroupManager().isUserInGroup (issue.get("creator"), "team-student-consultants")

Any suggestions?

Thanks in advance!

1 answer

1 accepted

0 votes
Answer accepted
David Fischer
Community Champion
November 27, 2018

Hi Andy,

you seem to have inverted the condition. Why is that? Based on your description, it seems that the condition should be :

issue.get("Reported on behalf of")== null && ! ComponentAccessor.getGroupManager().isUserInGroup (issue.get("creator"), "team-student-consultants")
Andrew Januszak
Contributor
November 28, 2018

Hi David, 

I need the post function to run only if the field Reported on behalf of is not blank or the creator is not a member of the team-student-consultants group.

My logic was wrong here and using && instead of || as you did in your code works! 

Final code is, 

issue.get("Reported on behalf of")!= null && ! ComponentAccessor.getGroupManager().isUserInGroup (issue.get("creator"), "team-student-consultants")

Thank you for your help! 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events