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!
-Roberto
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 @PD 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!
-Roberto
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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 {it.issueLinkType.name == "Cloners"}
or
def clonedIssues = ComponentAccessor.getIssueLinkManager().getOutwardLinks(issue.getId())?.findAll {it.issueLinkType.outward == "clones"}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @PD 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)?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@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:
linkMgr.getLinkCollectionOverrideSecurity(issue).getAllIssues()
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I think the sequence of operation when cloning an issue is:
So you might have more luck with a listener that listens to the issueLinkCreated event.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.