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

0 votes
Accepted answer

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 yesterday in Feedback & Announcements

How do you analyze GC logs, thread dumps and head dumps?

Hi awesome community!  In this article, I would like to describe the one of the toolset (service) for the analyze some problems on different Java-based instances, of course, as Atlassian admini...

91 views 0 7
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