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
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]
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.