Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How can I link issues between two jira instances in scriptrunner

aas
Contributor
October 27, 2024

I have groovy script on post function which links issue with another issue in different jira instance

def linkIssues(String remoteIssue){
def linkBuilder = new RemoteIssueLinkBuilder()
linkBuilder.issueId(issue.id)
linkBuilder.url("https://myJira.net/browse/${remoteIssue}")
linkBuilder.title("${remoteIssue}")
linkBuilder.relationship("depends on)")
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def remoteIssueLinkService = ComponentAccessor.getComponent(RemoteIssueLinkService)
def validationResult = remoteIssueLinkService.validateCreate(user, linkBuilder.build())
try{
if (validationResult.isValid()) {
remoteIssueLinkService.create(user, validationResult)
log.info "Remote link created"
}else {
log.error "Remote link NOT created ${validationResult.errorCollection.errorMessages}"
}
} catch(Exception ex){
log.warn(ex.getMessage())
}
}

 

It works and issues are linked but I don't see status of linked issue in my Jira. But when I link issues manually status of linked issue is available.

1 answer

Suggest an answer

Log in or Sign up to answer
0 votes
John Funk
Community Champion
October 27, 2024

Hi Aas,

There is ScriptRunner Connect app that would be perfect for that. 

aas
Contributor
October 28, 2024

Hi @John Funk , thanks for reply, but I hope there is some java api to solve my problem with scriptrunner

TAGS
AUG Leaders

Atlassian Community Events