Script Runner doesn't work on JIRA 6.3.15 for linking issues

a create and link an issue on JIRA 6.3.11 . (work fine)

but on 6.3.15 the issue is created but the link doesn't work 

import com.atlassian.jira.user.UserUtils
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.link.IssueLink
import com.atlassian.jira.util.ImportUtils
import com.atlassian.crowd.embedded.api.User
import com.opensymphony.workflow.WorkflowContext
import org.apache.log4j.Category
import com.atlassian.jira.issue.fields.CustomField
 
log = Category.getInstance("com.onresolve.jira.groovy.CreateDependentIssue")
 
// Configurable section
def projectName = "Dicom Management" // Name of project you want to create the issue in
//def CustomRequestTypeName = "customfield_10010"
//def CustomTerminalName = "customfield_11811"
def customFieldManager = ComponentManager.getInstance().getCustomFieldManager()
//CustomField customFieldRequestType = customFieldManager.getCustomFieldObject(CustomRequestTypeName)
//CustomField customFieldTerminal = customFieldManager.getCustomFieldObject(CustomTerminalName)
//def customFieldLocationVal = issue.getCustomFieldValue(customFieldLocation)
//def customFieldTerminalVal = issue.getCustomFieldValue(customFieldTerminal)

// for other customisations change the code below
issueMgr = ComponentManager.getInstance().getIssueManager()
projectMgr = ComponentManager.getInstance().getProjectManager()
String currentUser = ((WorkflowContext) transientVars.get("context")).getCaller();
User currentUserObj = UserUtils.getUser(currentUser);
def wasIndexing = ImportUtils.indexIssues
ImportUtils.indexIssues = true
issueFactory = ComponentManager.getInstance().getIssueFactory()
newissue = issueFactory.getIssue()
//newissue.setSummary (" RH - "+issue.summary+"- "+customFieldTerminalVal)
newissue.setSummary ("RH - "+issue.summary)
newissue.setProject (projectMgr.getProjectByName(projectName))
newissue.setIssueType (issue.getIssueType())
newissue.description = issue.description
newissue.assignee = currentUserObj;
//issue.getAssignee()
newissue.reporter = currentUserObj;

 
params = ["issue":newissue]
subTask = issueMgr.createIssue(currentUserObj, params)
println subTask.get("key")
 
// get the current list of outwards depends on links to get the sequence number
linkMgr = ComponentManager.getInstance().getIssueLinkManager()
def sequence = 0
for (IssueLink link in linkMgr.getInwardLinks(issue.id)) {
    if ("Blocks" == link.issueLinkType.name) {
        sequence++;
    }
}
 
linkMgr = ComponentManager.getInstance().getIssueLinkManager()
// TODO: Should check that 10000 is always the link id for Blocks
linkMgr.createIssueLink (newissue.id, issue.id, 10000, 1, currentUserObj)
ImportUtils.indexIssues = wasIndexing

so this code seems to not work :

 

// get the current list of outwards depends on links to get the sequence number
linkMgr = ComponentManager.getInstance().getIssueLinkManager()
def sequence = 0
for (IssueLink link in linkMgr.getInwardLinks(issue.id)) {
    if ("Blocks" == link.issueLinkType.name) {
        sequence++;
    }
}
 
linkMgr = ComponentManager.getInstance().getIssueLinkManager()
// TODO: Should check that 10000 is always the link id for Blocks
linkMgr.createIssueLink (newissue.id, issue.id, 10000, 1, currentUserObj)

 

is it right or I'm wrong ??

2 answers

0 vote

What's in the logs?

nothing. The issue is created but not linked.. We have downgrade to 6.3.11 because we have other issues with other plugins

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 Jul 10, 2018 in Marketplace Apps

If you’re an Atlassian app developer, you’ll want to know about Atlas Camp!

This September 6-7, hundreds of Atlassian App developers will flock to Barcelona Spain to build skills, discover product roadmaps, meet face-to-face with the Atlassian team, and learn how to extend t...

134 views 0 4
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