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

Olivier Albertini February 26, 2015

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 votes
Olivier Albertini March 2, 2015

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

0 votes
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 27, 2015

What's in the logs?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events