Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to get an Insight object attribute suffix?

Robin Weiß December 6, 2019

Hey Folks,

I would like to access the suffix of an attribute of an Insight Object in a groovy script. 
But I can not find a method to get the suffix in the Insight API. 

In my script I already got an ObjectAttributeBean. The properties of the ObjectAttributeBean do not include the suffix.

 

Could you tell me the method or provide a code example to get the suffix if it is even possible? 

Thanks a lot for your help

1 answer

1 accepted

2 votes
Answer accepted
Craig Haynal
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.
December 6, 2019

You need to get the ObjectTypeAttributeBean which defines the properties of the attribute and call getSuffix() on it.  e.g. for a float field with Id 2372 and a suffix set, you could do something like:

import com.atlassian.jira.component.ComponentAccessor

Class objectTypeAttributeFacadeClass = ComponentAccessor.getPluginAccessor().getClassLoader().findClass("com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectTypeAttributeFacade")
def objectTypeAttributeFacade = ComponentAccessor.getOSGiComponentInstanceOfType(objectTypeAttributeFacadeClass)
def costObjectTypeAttributeBean = objectTypeAttributeFacade.loadObjectTypeAttributeBean(2372)
def costSuffix = costObjectTypeAttributeBean.getSuffix()
// return suffix ($)
costSuffix

Strangely it doesn't seem to be in the current javadoc for Insight, but it does work for me.  ObjectTypeAttributeBean in Insight javadoc 5.1 in case you need more information.  Best of luck!

Robin Weiß December 11, 2019

Thanks a lot. I worked perfekt for me.

Suggest an answer

Log in or Sign up to answer