Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
Level
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Adding multiple user groups to insight object using Groovy script

Hi, 

 

I have problem at hand where i need to use Insight automation and Groovy-script to make our asset management work. What i have in mind is that i have few Insight automation that checks for all objects that have empty group atribute and then add "Group1" to them. 

 

Heres the script so far: 

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);

Class objectTypeAttributeFacadeClass = ComponentAccessor.getPluginAccessor().getClassLoader().findClass("com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectTypeAttributeFacade");
def objectTypeAttributeFacade = ComponentAccessor.getOSGiComponentInstanceOfType(objectTypeAttributeFacadeClass);

Class objectAttributeBeanFactoryClass = ComponentAccessor.getPluginAccessor().getClassLoader().findClass("com.riadalabs.jira.plugins.insight.services.model.factory.ObjectAttributeBeanFactory");
def objectAttributeBeanFactory = ComponentAccessor.getOSGiComponentInstanceOfType(objectAttributeBeanFactoryClass);


def objectTypeAttributeBean = objectTypeAttributeFacade.loadObjectTypeAttributeBean(162)


def newObjectAttributeBean = objectAttributeBeanFactory.createObjectAttributeBeanForObject(object, objectTypeAttributeBean, 'group1');

objectTypeAttributeBean = objectFacade.storeObjectAttributeBean(newObjectAttributeBean);

 

It gets the job done, but while setting the group it overwrites the previous value - What i need it to do is to Add the group1 as second group. 

 

Another way to overcome this is if i can somehow input 2 different groups in newObjectAtributeBean - but that does not seem to work. So far i've tried following: 

def groups = ['group1', 'group2']
def newObjectAttributeBean = objectAttributeBeanFactory.createObjectAttributeBeanForObject(object, objectTypeAttributeBean, 'group1');
def newObjectAttributeBean = objectAttributeBeanFactory.createObjectAttributeBeanForObject(object, objectTypeAttributeBean, 'group1', 'group2');
def newObjectAttributeBean = objectAttributeBeanFactory.createObjectAttributeBeanForObject(object, objectTypeAttributeBean, 'group1, group2');
def newObjectAttributeBean = objectAttributeBeanFactory.createObjectAttributeBeanForObject(object, objectTypeAttributeBean, groups);

Whit out success... 

 

Any ideas? 

2 answers

Hi Carl,

Have you ever found out how to do this? I am facing exactly the same issue...

Thanks,

Paul

Any answers on this?

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Marketplace Apps & Integrations

New Cloud Apps Roundup - April 2021

Atlassian's marketplace partners have had a very productive start to 2021! Since our last roundup, our developer community has added over 160 new cloud apps to the Atlassian Marketplace to help you...

317 views 3 20
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you