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

Insight groovy scripts: how to create new object type?

Good afternoon,
I am stuck with groovy automation script, which will create new object type with given name string in object schema.
I tested a lot with insight classes. ObjectTypeFacade class has a method createObjectTypeBean( objectTypeBean), but it is used as i understood to convert MutableObjectTypeBean to ObjectTypeBean.

I have no clue whether it is possible to create new object type with groovy script at all.

I also tried with ImmutableFactory

def immutableFactory = ComponentAccessor.getOSGiComponentInstanceOfType(ComponentAccessor.getPluginAccessor().getClassLoader().findClass(""));

def newObjectType = immutableFactory.createObjectType(name=someString);

but it gives me an error: 
MissingMethodException: No signature of method: is applicable for argument types: (java.lang.String)

Does anyone has a solution to create this MutableObjectTypeBean which is used to set the data? The following doesn't work either.

def mutableObjectTypeBean = ComponentAccessor.getOSGiComponentInstanceOfType(ComponentAccessor.getPluginAccessor().getClassLoader().findClass(""));

MutableObjectTypeBean newObjectType = new MutableObjectTypeBean();

And is it possible just to parse Name and ParentObjectTypeId properties, because if i give it a random Id also, this might make a conflict as the id could be already in use.

1 answer

1 accepted

0 votes
Answer accepted

Found the solution. Had to import the class through import (not through

ComponentAccessor like i tried) to create new object :
Then you can create new object type like this using MutableObjectTypeBean constructor:
MutableObjectTypeBean newObjectType = new MutableObjectTypeBean();

setObjectSchemaId, setIconBean, setName are mandatory to use after that or else it will throw an error if you will try to store it in schema as those are main parameters for an object type to have on creation.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Jira Service Management

Jira Service Management Documentation Opportunities

Hello everyone, Hope everyone is safe! A few months ago we posted an article sharing all the new articles and documentation that we, the AMER Jira Service Management team created. As mentioned ...

196 views 0 5
Join discussion

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