It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Condition for Clone of issue

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

0 votes
Answer accepted

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

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

Congrats!

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Jira

Demo Den Ep. 7: New Jira Cloud Reports

Learn how to use two new reports for next-gen projects in Jira Cloud:  Cumulative flow diagram and Sprint burndown chart. Ivan Teong, Product Manager, Jira Software, demos the Cumulative ...

303 views 1 3
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you