How to check a key of linked issue?

Serj Shcherbakov
Contributor
February 19, 2019

Hi Folks, Experts,

I stugged with requiment...

I need to create issue via workflow post-function (groovy create and link).

That schould work only if current issue haves linked to the issuekey: CPWEB-2056

How can i make it?

1 answer

Suggest an answer

Log in or Sign up to answer
0 votes
Nic Brough -Adaptavist-
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 20, 2019

Read the links from the current issue with

issueLinkManager.getOutwardLinks(issue.getId())

That will return a list, which you can iterate through looking for

it.getKey().equals("CPWEB-2056")

Charles Huggins February 21, 2019

Hi Nic, thanks for provided respond, 
Currently still can't reach goal with this script:

if (issueLinkManager.getOutwardLinks(issue.id)*.getKey().equals("CPWEB-2056")) {
true
}

image.png

Charles Huggins February 21, 2019

Hi Nic, thanks for provided respond, 
Currently still can't reach goal with this script:

if (issueLinkManager.getOutwardLinks(issue.id)*.getKey().equals("CPWEB-2056")) {
true
}

image.png

What next? Hope you assist, 

Serj Shcherbakov
Contributor
March 4, 2019

@Nic Brough -Adaptavist-  still cannot resolve,

Can you help with more complex example, 

Thx!

Serj Shcherbakov
Contributor
March 4, 2019
import com.atlassian.jira.component.ComponentAccessor
def linkManager = ComponentAccessor.issueLinkManager

linkManager.getOutwardLinks(issue.getId()).each{
def linkedIssue = it.destinationObject
if (linkedIssue.key == "CPWEB-1823") {
}
}
true

 doesnt works(

TAGS
AUG Leaders

Atlassian Community Events