restrict Priority values on edit - revisited

A) This works (restrict priorities to those with ID less than 5)

def allowedPriorities = constantsManager.getPriorityObjects().findAll{
	it.id.toInteger() < 5
}.collectEntries {
	[(it.id): it.name]
}
priority.setFieldOptions(allowedPriorities)

 

B) This does NOT work (attempting to restrict priorities to only 1 & 3)

def allowedPriorities = constantsManager.getPriorityObjects().findAll{
	it.id.toInteger() == [1,3]
}.collectEntries {
	[(it.id): it.name]
}
priority.setFieldOptions(allowedPriorities)

 

Can someone please help me with why code snippet B does not work?

Thanks in advance,

Conor

 

 

1 answer

1 accepted

Accepted Answer
0 votes

Hi Conor, 

If you want to get only priorities with ids 1 or 3 then the findAll closure should be

it.id.toInteger() in [1, 3]

That simple smile

Thanks Thanos!

Suggest an answer

Log in or Sign up to answer
Community showcase
Published 42m ago in Jira

My Top 10 Favorite Features in the New Jira

  This morning, our CEO Scott Farquhar shared exciting news about a reimagined experience in Jira Software. As Principal Product Manager for Jira Software, I wanted to   re-share h...

36 views 0 3
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you