Skip to content

Instantly share code, notes, and snippets.

@jechlin
Created May 22, 2016 18:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jechlin/e2986c732852789b317dcfaf97efb37a to your computer and use it in GitHub Desktop.
Save jechlin/e2986c732852789b317dcfaf97efb37a to your computer and use it in GitHub Desktop.
package examples
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.link.IssueLinkManager
log.debug("is subtask: ${issue.isSubTask()}")
if (issue.isSubTask()) {
log.debug("issue id: ${issue.id}")
log.debug("parent: ${issue.parentObject}")
def issueManager = ComponentAccessor.getIssueManager()
def refreshedIssue = issueManager.getIssueObject(issue.parentObject.id)
log.debug("sibs: ${refreshedIssue.subTaskObjects*.key}")
def issueLinkManager = ComponentAccessor.getComponent(IssueLinkManager)
issueLinkManager.createIssueLink(issue.id, issueManager.getIssueObject("SRTESTPRJ-14").id, 10000L, 0, ComponentAccessor.jiraAuthenticationContext.loggedInUser)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment