---
title: "Working with Insight object's attributes using JMWE (Server/DC) and Groovy"
canonical: "https://support.appfire.com/space/SUPPORT/239206657/Working%20with%20Insight%20object's%20attributes%20using%20JMWE%20(Server%2FDC)%20and%20Groovy"
format: markdown
---
## \uD83E\uDD14 Problem

Customers might need to pull a specific Insight's object attribute info. While the `issue.get("<customfield_id>")?.first()?.getInsightAttributeValue("<attribute_name>")` code snippet can help in some cases, if the custom field references another Insight object instead of a regular value, the **id** will be returned <u>**instead of the actual value**</u>.

Refer to the example below: 

![image](media://178e47d0-1eaa-4dfa-bf5a-4d0be3410e0f)

![image](media://52fad336-dfba-436a-9995-62cbf3d4ecf4)

## \uD83C\uDF31 Solution

1. Use Groovy and the Insight-related classes to explore and drill down into an Insight field object attributes:
2. As you can see in the recording below, we have managed to get the “*Server Owner*” attribute value (not just the ID shown in this article's *Problem *section), even when it references another Insight object.

![User_case.mp4](media://2c90b37b-2571-4bcf-94c9-4bb3b5551a7b)

> ℹ️ The code snippet provided earlier can vary depending on the Insight object attribute type. For example, if we <u>multiple</u> values for an “*Approvers*” Insight object attribute that refers to a User’s property type from another Insight object (refer to the captures below), then the code snippet will look as follows:

```
import com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectFacade
def objectFacade = getComponent(ObjectFacade)
def objIds = issue.get("<custom_insight_field_id>").first().getInsightAttributeValue("<object_main_attribute>")
def names_str = ""

def userManager = ComponentAccessor.getUserManager()
for (i in objIds) {
  def jiraUsrId = objectFacade.loadObjectBean(i).getInsightAttributeValue("<object_main_attribute>")
  names_str = names_str + userManager.getUserByKey(jiraUsrId).displayName + " "
}
return names_str.trim()
```

![image](media://589ee5e4-cb1d-407a-8e43-a612de2f5d2e)

![image](media://b609fb41-75f4-42e4-ab55-59cd354a9bc1)

![image](media://3cec7da5-5bb8-4056-ae91-cf401e56baf0)

## \uD83D\uDCCE Related articles

- [https://confluence.atlassian.com/assetapps/assets-javadoc-1168847895.html](https://confluence.atlassian.com/assetapps/assets-javadoc-1168847895.html) - as mentioned in the Atlassian article, you can review the Assets Javadoc pages by navigating to `https://docs.atlassian.com/insight/<version>` using the corresponding Assets version, for instance: [https://docs.atlassian.com/assets/10.4.8/](https://docs.atlassian.com/assets/10.4.8/)
- ObjectFacade class info (used in this KB article) [https://docs.atlassian.com/assets/10.4.8/com/riadalabs/jira/plugins/insight/channel/external/api/facade/ObjectFacade.html](https://docs.atlassian.com/assets/10.4.8/com/riadalabs/jira/plugins/insight/channel/external/api/facade/ObjectFacade.html)