You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.
Join groupJoin the community to find out what other Atlassian users are discussing, debating and creating.
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?
Hi Carl,
Have you ever found out how to do this? I am facing exactly the same issue...
Thanks,
Paul
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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...
Connect with like-minded Atlassian users at free events near you!
Find an eventConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.
Host an eventYou're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.