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

This widget could not be displayed.

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
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted 7 hours ago in Statuspage

What are your best incident management tips and stories? #HugOps

 👋Community members! Downtime happens. And great incident response takes a village. Teams like Support, Dev, SRE, Ops, IT, and Marketing have to come together to resolve the problem while keep...

25 views 0 2
Join discussion

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