You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
I am doing a validation to check that only 2 users can be added in the multi users pickers.
Iam getting error on the last line. Please advice.
//ComponentAccessor.attachmentManager.getAttachments(issue).size() >= 1
ComponentAccessor.customFieldManager.getCustomFieldObjects(issue)?.findByName("Multi user picker").size() >= 1
Your code is getting a list of custom fields with the name "multi user picker" and looking at the size of that list.
What you really want to do is get the current value of the field for the current issue try something like
final String customFieldName = "My Custom Field"
def customFieldManager = ComponentAccessor.customFieldManager
def customField = customFieldManager.getCustomFieldObjects(issue).findByName(customFieldName)
assert customField : "Could not find custom field with name $customFieldName"
def customFieldVal = issue.getCustomFieldValue(customField)
def numberOfOptions = customFieldVal.size()
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.