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

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

Groovy script to move objects to another schema


I am looking for a way to keep a history of the objects that are removed from the sources. I want to move them to a new scheme.
I want to do it with an automatic rule that calls a script.
I have tried the following code to move the objects to this new schema which is a clone of my main one. But dosen't work

Class objectSchemaFacadeClass = ComponentAccessor.getPluginAccessor().getClassLoader().findClass("");
ObjectSchemaFacade objectSchemaFacade = ComponentAccessor.getOSGiComponentInstanceOfType(objectSchemaFacadeClass);

Class objectTypeFacadeClass = ComponentAccessor.getPluginAccessor().getClassLoader().findClass("");
ObjectTypeFacade objectTypeFacade = ComponentAccessor.getOSGiComponentInstanceOfType(objectTypeFacadeClass);

List<ObjectTypeBean> crcAllObjectTypes = objectTypeFacade.findObjectTypeBeansFlat(1)

ObjectTypeBean srcObjectType = crcAllObjectTypes.find
{ o -> == object.objectTypeId}

Class objectFacadeClass = ComponentAccessor.getPluginAccessor().getClassLoader().findClass("");
ObjectFacade objectFacade = ComponentAccessor.getOSGiComponentInstanceOfType(objectFacadeClass);

Class objectTypeAttFacadeClass = ComponentAccessor.getPluginAccessor().getClassLoader().findClass("");
ObjectTypeAttributeFacade objectTypeAttFacade = ComponentAccessor.getOSGiComponentInstanceOfType(objectTypeAttFacadeClass);

MoveObjectMapping moveMap = new MoveObjectMapping();
List<ObjectTypeAttributeBean> fromAtts = objectTypeAttFacade.findObjectTypeAttributeBeans(;
List<ObjectTypeAttributeBean> toAtts = objectTypeAttFacade.findObjectTypeAttributeBeans(407);

def index = 0;

{ item -> MoveAttributeMapping temp = MoveAttributeMapping.create(item,fromAtts[index]);[index].id,temp); index++; }

MoveObjectBean mObject = new MoveObjectBean();

try { mObject.setIql("Key = " + object.objectKey); objectFacade.moveObjects(mObject); // objectFacade.storeObjectBean(object) }
catch (Exception vie)

{ log.warn("Could not update object attribute due to validation exception:" + vie.getMessage()); }

0 answers

Suggest an answer

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

New Cloud Apps Roundup - Spring 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...

124 views 3 14
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