trying to take a field that has a list of customers and be able to query for only issues where the number of customers is greater than 1. The field will also have null values at times
Try using multiuser picker field to store list of customers and calculated field (provided by ScriptRunner) with this script to store it count
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.Issue import com.atlassian.jira.issue.fields.CustomField /** * Get number of users for multiuser picker */ CustomField multiuserCstFld = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("FieldName") if (multiuserCstFld == null) return "custom field not found" return "" + ((ArrayList) multiuserCstFld.getValue(issue)).size()
I've tried this on the 'Components' field and receive an error:
"custom field not found"
Does this not work on OOTB fields?
Components is not a custom field.
You should method of Issue class use https://docs.atlassian.com/software/jira/docs/api/7.1.2/com/atlassian/jira/issue/Issue.html#getComponents--
Thank you!
It looks like you're new here. Sign in or register to get started.