Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

ScriptRunner - Identify Cloned Issues via Listener

hello Community,

Is there a way to have a listener trigger when an issue is cloned.

I do not see issue clone as one of the Events you can associate to a listener.

I am aware that a "CLONE" triggers a "CREATE", would there be a way to check the issue on create for a specific attribute that signifies that it was cloned as opposed to created?

Any help is much appreciated!


1 answer

2 votes

You are correct that you can only listen for CREATE event.

And I think that if your cloning process doesn't include either a summary prefix or clonners linked issue type, then there might not be anything in the event that will identify this as a clone.

Basically, if you can't tell from looking at any attribute of the issue that it was a clone rather than fresh ticket, then there is no way to know in the listener.

Hi @Peter-Dave Sheehan ,

The cloned issue has the issue linked of "cloned by" that JIRA appends.

This is my code for trying to pick up when something is cloned: 

Issue issue = event.issue
UserManager userManager = ComponentAccessor.getComponent(UserManager)

def clonedIssues = ComponentAccessor.getIssueLinkManager().getOutwardLinks(issue.getId())?.findAll {it.issueLinkType.outward == "Cloners"};

if (clonedIssues) {
//Do all the processing I need to do since this is a cloned issue

 Utilizing the above code I still cant seem to target only the issues that are created through clone as opposed to just naturally created.

Do you see anything faulty in code or is there a different way to asses?

The prefix of "clone" is not reliable since users can replace it before they initiate clone.

Thanks for the help!


IssueLinkType have 3 main attributes: name, outward description and inward description.

Looks like you were looking at the value of the outward description and comparing it to the string that matches the name.

Try either:

def clonedIssues = ComponentAccessor.getIssueLinkManager().getOutwardLinks(issue.getId())?.findAll { == "Cloners"}


def clonedIssues = ComponentAccessor.getIssueLinkManager().getOutwardLinks(issue.getId())?.findAll {it.issueLinkType.outward == "clones"}

Hi @Peter-Dave Sheehan , I have added the above code to Post-function of create transition to identify the CLONED issues and do come operation based on that. 

But, It always returns EMPTY [] list. Is there any other way to do it (except listener)? 

@Peter-Dave Sheehan, I also cannot get any cloner links in the Create transition.  I added a post function at the very end of the transition, after the Create Event is fired, just to log this:


But it never returns cloner links even when the issue has them.  If I run that same line in the console to check the new cloned issue, it returns the cloner link.  But not in the Create transition.  It sure would be nice to know if that's intentional or a bug!

I think the sequence of operation when cloning an issue is:

  1. Start Create Transition
    1. Run Create Validator
    2. Run Create Post Function
      1. Launches the IssueCreatedEvent
  2. Create Issue Link
    1. Launches the IssueLinkCreatedEvent

So you might have more luck with a listener that listens to the issueLinkCreated event.

Thanks, Peter-Dave, that's very helpful, and a Listener does indeed work.

Suggest an answer

Log in or Sign up to answer

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