I want to use Groovy in a post-function to get the approver from a custom field of the type Multi-User-Select and then read a specific attribute from Insight, where the approver is stored as an object.
The script I have does not work. It only works if the user is read from an Assets-Objects field.
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.fields.CustomField
CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager()
Class objectFacadeClass = ComponentAccessor.getPluginAccessor().getClassLoader().findClass("com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectFacade")
def objectFacade = ComponentAccessor.getOSGiComponentInstanceOfType(objectFacadeClass)
CustomField u = customFieldManager.getCustomFieldObject(10406)
ArrayList myValue = issue.getCustomFieldValue(u) as ArrayList
ArrayList myAttributes = []
return myValue
myValue.each {
def myAttrValue = objectFacade.loadObjectAttributeBean(it.getId(), 7201).getObjectAttributeValueBeans()[0].getValue()
myAttributes.add(myAttrValue)
}