Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Insight Attribute Label Names

Mathis Hellensberg
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 26, 2019

I was wondering if there is any way to get an attribute label name of an object in Insight?

Getting the attribute values is somewhat straight forward, but I can't seem to find a way to get the attribute label name? 

The code below show how to get an array of all the attribute values of an objectBean, but if I wanted to create a map instead how would I do this?

Ex: [key: "NKDB-34", name: "Something", created: "Date"...]

 

import com.atlassian.jira.component.ComponentAccessor;

Class objectFacadeClass = ComponentAccessor.getPluginAccessor().getClassLoader().findClass("com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectFacade");
def objectFacade = ComponentAccessor.getOSGiComponentInstanceOfType(objectFacadeClass);

//Get insight object.
def objectKey = "NKDB-34";
def insightObject = objectFacade.loadObjectBean(objectKey);

//Get attributes of insight object as a list.
def attributeList = insightObject.getObjectAttributeBeans();

//Get an array with all the values from a insight object.
def attributeValues = [];
attributeList.each { attribute ->
def value = attribute.getObjectAttributeValueBeans()[0];
if (value) {
attributeValues.push(value.getValue());
} else {
attributeValues.push(value);
}
}
return attributeValues; 

 

I'm on Server (8.3.1) btw...

1 answer

0 votes
HumanCheese
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 26, 2019

I would also like to know :)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events