Retrieve attributes from Insight


I am working my way through but when I use Assets.getAttributeValues() I get MissingMethodException.

My goal is to set a CustomField based on Insight object attribute value.

I only retrieved the Asset object id so far.

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.fields.config.manager.PrioritySchemeManager

// Make things shorter
def cfm                      = ComponentAccessor.getCustomFieldManager()
def userManager              = ComponentAccessor.userManager
def issueService             = ComponentAccessor.issueService
def issueManager             = ComponentAccessor.issueManager
def constantsManager         = ComponentAccessor.constantsManager
def subTaskManager           = ComponentAccessor.subTaskManager
def prioritySchemeManager    = ComponentAccessor.getComponent(PrioritySchemeManager)
def applicationProperties    = ComponentAccessor.applicationProperties

// Aliasses
def issueKey                 = 'TEST-1'

// Get fields
def issue                    = issueManager.getIssueObject(issueKey)
def AssetCField1             = cfm.getCustomFieldObject("customfield_1")
def AssetCField2             = cfm.getCustomFieldObject("customfield_2")

// Get values
def AssetCField1Value        = issue.getCustomFieldValue(AssetCField1)
def AssetCField2Value        = issue.getCustomFieldValue(AssetCField2)
def AssetId                  = InsightObject1Value[0].id


Hope anyone can give me some pointers.

Hehe I was on an outdated Scriptrunner versions. I’ve updated to the latest and now getAttributeValues works.