Groovy Script for transitioning linked issues

com.onresolve.jira.groovy.groovyrunner

Hi All,

I am able to pick the issue and also the linked issue. Now I want to transition the linked issue based on the main issue.

I am written the below code to fetch the issue and the linked issue. Please assist me further to transition linked issue. My requirement is like project A has an issue and Project B has an issue. Project B's issue is cloned to Project A;s issue. So when the project A's issue moves to other state then automatically the B's issue status should also change.

class LinkedIssue extends AbstractIssueEventListener {
Logger log = Logger.getLogger(LinkedIssue.class)

@Override
void workflowEvent (IssueEvent event)
{
log.setLevel(org.apache.log4j.Level.DEBUG)
def itsdIssue
Issue issue = event.getIssue()
def issuestatus = issue.getStatusObject().getName().toUpperCase()
def issueType = issue.issueTypeObject.name
log.debug ("issue :" +issue);
log.debug ("issue ID :" +issue.id)
log.debug ("issue status:" +issuestatus);
log.debug ("issue Type: " +issueType);



def componentManager = ComponentManager.getInstance()
def issueLinkManager = componentManager.getIssueLinkManager()

def issueLink = issueLinkManager.getOutwardLinks(issue.id)
log.debug ("Linktype: " + issueLink.issueLinkType.name)

def linkedIssueObj = issueLink.destinationObject;
log.debug ("Issue Key: " + linkedIssueObj.key)
}
}

1 answer

Here's a similar question which contains example script for transitioning linked issues

https://answers.atlassian.com/questions/183942/groovy-script-for-linked-issue-transition

Hope it helps smile

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Jira

5 ways you can make the most of Jira Software and Bitbucket Cloud

As part of the Bitbucket product team I'm always interested in better understanding what kind of impact the use of our tools have on the way you work. In a recent study we conducted of software devel...

77 views 0 5
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