Retrieve attributes from Insight

Heya,

I am working my way through https://docs.adaptavist.com/sr4js/latest/hapi/work-with-assets-insight 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
import com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectFacade

// 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

AssetId

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.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.