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()
Hi Atlassian Community, My name is Avni Barman, and I am a Product Manager on the Confluence Cloud team. Based on feedback from you, we are giving admins more power to create templates that a...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events