Condition for Clone of issue

Alex Cumberland
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.
October 28, 2019

I am updating a transition in the workflow with a clone as part of the transition.   It will clone the issue from the "Customer" project to the "Development Team" project when the customer issue is approved.

However, I would like to add a condition that would allow this to happen only if the issue has not already been cloned.  In the set up there is a section for Condition but I have not been able to get it to work if there is already a cloned issue off the issue and it just clones a new issue.

 

Here is the condition that I have tried to get working:

!issueLinkManager.getInwardLinks(issue.getId())*.issueLinkType.name.contains('is cloned by')

Like I said it just ignores it and creates a new clone anyway.

 

Here is the screen that I am talking about:

Condition.jpg

1 answer

1 accepted

3 votes
Answer accepted
Jack Nolddor _Sweet Bananas_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
October 28, 2019

Hi Alex,

Could you try the following?

 

import com.atlassian.jira.component.ComponentAccessor

// Services & Managers
def issueLinkManager = ComponentAccessor.issueLinkManager


//--------------------------------------------------------------
// You must change the following variables as your needs
//--------------------------------------------------------------
def linkDesc = "is cloned by"
//--------------------------------------------------------------


// Look for all linked issues
def anyInwardLinkedIssues = issueLinkManager.getInwardLinks(issue.id).any{issueLink -> issueLink.issueLinkType.inward.equalsIgnoreCase(linkDesc)}
def anyOutwardLinkedIssues = issueLinkManager.getOutwardLinks(issue.id).any{issueLink -> issueLink.issueLinkType.outward.equalsIgnoreCase(linkDesc)}
return !(anyInwardLinkedIssues || anyOutwardLinkedIssues)

 

Regards

Alex Cumberland
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.
October 28, 2019

OMG... that so worked... Thanks so much

Like # people like this
Jack Nolddor _Sweet Bananas_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
October 28, 2019

Congrats!

Suggest an answer

Log in or Sign up to answer