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

Verify Assignee's Group in JMWE Validator

Hi There, 

 

I know there's a way to verify the user's group in JMWE via the following expression:

user.groups.includes("group name")

However, I met the scenario that needs to verify the assignee's group. Any advice on the expression?

 

Thanks,

Olive

 

1 answer

1 accepted

2 votes
Answer accepted

Hi @Olive Sun ,

you can do this:

issue.assignee && issue.assignee.groups.includes("group name")

It's important to first test whether issue.assignee is null, otherwise you'll get an error accessing its groups when it is.

Thanks, @David Fischer _Appfire_ !That works perfectly.

Like John Funk likes this

Hi @David Fischer _Appfire_, would you mind also share the way to verify whether the assignee is in the specific project role or not?

Not sure if the following expression is correct.

 

issue.assignee && issue.assignee.getProjectRoles(issue.project).some(pr => pr.name == "Developers")

 

@Olive Sun it is (assuming you're looking for the Developers project role)

Like Olive Sun likes this

Hi @David Fischer _Appfire_ , I tried that expression, it only works when I set with "==":

issue.assignee && issue.assignee.getProjectRoles(issue.project).some(pr => pr.name == "Developers")

If I set with "!=" as follows, it doesn't work and keeps return "True".

issue.assignee && issue.assignee.getProjectRoles(issue.project).some(pr => pr.name != "Developers")

 Any thoughts?

 

Thanks,

Olive

Hi @Olive Sun 

why would you use != ? You mean for a different requirement? What would be the requirement then?

David

Hi @David Fischer _Appfire_ , for one transition, I want to make the condition as the user is in project Role A, and for the other transition, I want to make the condition opposite wat. This means the user is not in project Role A. 

 

That's why I want to use !=, any thoughts?

Hi @Olive Sun ,

that would be:

issue.assignee && !issue.assignee.getProjectRoles(issue.project).some(pr => pr.name == "Developers")

Thank yoooooou!

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Apps & Integrations

Send an Email or Publish to Confluence - What should you do with your release notes?

Background When you hear the words ‘Release notes’, almost always you think of an unsolicited email from a software vendor. But I am here to tell you that from our data, sending release notes via E...

125 views 1 2
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