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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

JMWE Validation - is it possible to check a multi-picker field by groups that user has access to?

Hi,

 

I'm trying to validate a custom filed that is a user multi-picker. I want to send an email to the people specified in that field but there is always a chance that a user will put there a person that is not meant to see that email.

So what I want to do is to check if users picked in that custom filed are members of one specific group. 

Maybe I'm not searching carefully enough but I cannot find any solution.
So far i have managed to do this (not much considering this is a tutorial part mostly):

!!issue.customfield_15206 && issue.customfield_15206.some(it => it.groups == "team_name")

What I've learned is tht the second part is always false as te "it" object has no attribute groups. 
Is there any way to achieve that? Or should I change the approach? Jira Automation maybe?

1 answer

1 accepted

0 votes
Answer accepted

Hi @Jeremiasz Stróżyk ,

first of all, Jira Automation won't help you, since it doesn't integrate with workflows and thus doesn't offer any support for workflow validation.

Now, the problem with your Jira expression is that User picker custom fields, unlike standard user fields such as Assignee, don't return User "objects" but just a generic JavaScript object that has no methods.

However, there is a workaround: you can create a "real" user object from an accountId.

Also, your code seems to be checking that at least one user is selected in the custom field, and that at least one user in the field is in the team_name group. I think that's not your goal - you want to check that all users selected in the custom field are in the group, right?

Therefore, this Jira expression should work:

!issue.customfield_15206 || issue.customfield_15206.every(it => (new User(it.accountId)).groups.includes("team_name"))

 Regards,

David 

Hi @David Fischer _Innovalog_ 

That works perfectly, thanks a lot :)

So simple ;)

Regards,

Jerry

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Site Admin
TAGS
Community showcase
Posted in Jira Software

Presenting the "Best of 2020" Jira Software roundup!

Catch up with Atlassian Product Managers in our 2020 Demo Den round-up! From Advanced Roadmaps to Code in Jira to Next-Gen Workflows, check out the videos below to help up-level your work in the new ...

7,138 views 8 28
Join discussion

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