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

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

Avatar

1 badge earned

Collect

Participate in fun challenges

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

Challenges
Coins

Gift kudos to your peers

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

Recognition
Ribbon

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!

Leaderboard

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
4,558,749
Community Members
 
Community Events
184
Community Groups

How to set multiple value to insight attribute using scriptrunner...

Edited

I am trying to pass arraylist ie "Values"  with multiple values to have an insight attribute updated with multiple values using below command

def new_attribute_value = objectAttributeBeanFactory.createObjectAttributeBeanForObject(InsightObject, Attribute_type_object, Values as String )
objectFacade.storeObjectAttributeBean(new_attribute_value)
but getting error as below
com.riadalabs.jira.plugins.insight.common.exception.ValidationInsightException: ValidationInsightException: Validation errors were found: rlabs-insight-attribute-76576: ErrorMessage{i18nKey='rlabs.insight.i18n.constraint.violation.ObjectAttributeValueBean.MinOne.value', parameters=[], additionalMessage=null}; at com.riadalabs.jira.plugins.insight.services.validation.ValidateObjectImpl.validateObjectAttributeBean(ValidateObjectImpl.java:149) at com.riadalabs.jira.plugins.insight.services.core.ObjectServiceImpl.storeObjectAttribute(ObjectServiceImpl.java:1021) at com.riadalabs.jira.plugins.insight.channel.external.api.facade.impl.ObjectFacadeImpl.storeObjectAttributeBean(ObjectFacadeImpl.java:122) at com.riadalabs.jira.plugins.insight.channel.external.api.facade.impl.ObjectFacadeImpl.storeObjectAttributeBean(ObjectFacadeImpl.java:115) at com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectFacade$storeObjectAttributeBean$3.call(Unknown Source) at Script574.run(Script574.groovy:99)

is there any other way to update multiple values to insight attribute 

1 answer

0 votes
Peter-Dave Sheehan
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Apr 28, 2023

First off... it's bad practice in Java/groovy to capitalize variables. Then it becomes too difficult to differentiate between class names and instances of classes.

But if your "Values" variable contains an ArrayList and you want each of them to generate an ObjectAttributeValue, you can't cast it as a String.  You must cast it as an Array of strings.

Like this:

def new_attribute_value = objectAttributeBeanFactory.createObjectAttributeBeanForObject(InsightObject, Attribute_type_object, Values as String[] )
objectFacade.storeObjectAttributeBean(new_attribute_value)

Notice "as String[]" instead of "as String"

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events