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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Can not set attribute value of type object to nothing/blank

I use groovy scripts to automate insight object.
How do I set an attribute of type object to nothing/blank?

I tried with that code:
import com.atlassian.jira.component.ComponentAccessor;

def objectFacade = ComponentAccessor.getOSGiComponentInstanceOfType(ComponentAccessor.getPluginAccessor().getClassLoader().findClass(""));
def objectBean = objectFacade.loadObjectBean(object.getId()).createMutable()
def d = objectFacade.deleteObjectAttributeBean(37)
def f = objectFacade.storeObjectBean(objectBean)

There is no error, but the object attribute is not nothing or deleted


Setting the value to "" of the example

produces the error:
2021-01-08 06:05:19,794 [http-nio-8080-exec-12] | Could not update object attribute due to validation exception:ValidationInsightException: Validation errors were found: rlabs-insight-attribute-37: ErrorMessage

{i18nKey='rlabs.insight.i18n.constraint.violation.ObjectAttributeValueBean.MinOne.value', parameters=[], additionalMessage=null}


2 answers

1 accepted

0 votes
Answer accepted
Hana Kučerová Community Leader Jan 09, 2021

Hi @Reto Zürcher ,

welcome to the Atlassian Community!

Just to be sure - which version of Insight do you have? Concept with deleteObjectAttributeBean always worked for me.

Are you sure about the number 37? It should be object attribute bean id. When you try to get it using attribute id (please replace 123 with the id of attribute you're trying to delete), do you get the same number? 

Integer attributeId = 123
def objectBean = objectFacade.loadObjectBean(object.getId()).createMutable()
objectAttributeBean = objectFacade.loadObjectAttributeBean(objectBean.getId(), attributeId)
if (!objectAttributeBean) {
// log error

Also, remove this line:

def f = objectFacade.storeObjectBean(objectBean)

Very fast and helpfull community reply, cool! Thank you very much!

Thanks for the solution!

We had a similar problem. We had an attribute that stores objects. We were removing objects from the attribute without a problem with:

 "objectFacade.storeObjectAttributeBean(ObjectAttributeBean accRightsAtt)" 

except when there was one object left in the attribute and then it had to be removed. 

The error was the same as Reto's, even though the cardinality on the attribute that stored the objects was min = 0.

Could not update object attribute 'Access rights' due to validation exception:ValidationInsightException: Validation errors were found: rlabs-insight-attribute-14893: ErrorMessage{i18nKey='rlabs.insight.i18n.constraint.violation.ObjectAttributeValueBean.MinOne.value', parameters=[], additionalMessage=null}; 

Hana's suggestion helped us very much, but all of this is very misleading and not at all intuitive. Is there a suggestion to improve this? The error at least?


Suggest an answer

Log in or Sign up to answer
Newest, 4.14.0

Atlassian Community Events