Link issues from a post function script

 

I need to link two sub tasks.

I've read some posts where such question was discussed:

https://community.atlassian.com/t5/Jira-questions/Script-Runner-Post-function-to-link-back-to-issue/qaq-p/41966

http://www.denizoguz.com/2013/06/29/jiraautomatically-linking-issues-with-a-script-during-create-transition/

from the code provided there I am stuck at this part:

import com.atlassian.jira.ComponentManager; 

def issueLinkTypeManager = componentManager.getComponentInstanceOfType(IssueLinkTypeManager.class);

 I get 

No such property: IssueLinkTypeManager for class
groovy.lang.MissingPropertyException: No such property: IssueLinkTypeManager for class

 As is written at atlassian jira/docs/api/6.2.4

getComponentInstanceOfType(Class<T> clazz)
          Deprecated. since 6.0 - please use the jira-api ComponentAccessor.getComponent(Class) instead

So I've tried to use Component accessor:

import com.atlassian.jira.component.ComponentAccessor;
ComponentAccessor.getComponent(IssueLinkTypeManager.class)

But I get the same error about IssueLinkTypeManager.

1 answer

0 votes
Gaston Valente Community Champion Jan 03, 2018

Aleksandr,

You should try with:

ComponentAccesor.getIssueLinkManager()

Suggest an answer

Log in or Join to answer
Community showcase
Teodora [Botron]
Published Feb 15, 2018 in Marketplace Apps

Jira Inferno: The Nine Circles of Jira Administration Hell

If you spend enough time as a Jira admin - whether you are managing a single, mid-sized instance, a large enterprise one or juggling multiple instances at once - you will eventually find yourself in ...

1,084 views 6 19
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot