Doesn't look like there's a good way to detect what's a clone via a listener. The "Cloners" issue link apparently isn't added at the time the issueCreated event is handled by the listner.
Anyone know is there's a way to detect cloning at issue create time?
Community moderators have prevented the ability to post new answers.
You're crazy man. I like you, but you're crazy. This does show up in the stack trace:
CreateIssueDetails.java com.atlassian.jira.web.action.issue.CreateIssueDetails createIssue
I don't want to do it ... but I just might! Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Whoops, I mean this is in the stack trace:
CloneIssueDetails.java com.atlassian.jira.web.action.issue.CloneIssueDetails doExecute
The other line I mentioned was in the stack trace, but wouldn't be very useful.
Thanks again
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Brian,
we also get this line in stacktrace.
CloneIssueDetails.java com.atlassian.jira.web.action.issue.CloneIssueDetails doExecute
But My question, how we do get source jira issue Id from which cloned happen in jira event listener ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vints
Check the comments below. The way we solved it in the table grid editor app is by creating a new custom field 'Origin ID' More information in the link
https://wiki.idalko.com/x/nYP4B
Francis
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for quick reply.
But we don't have provision to introduce new custom fields in jira, Is it possible with some other way ?
Actual Problem : we are add-on vendor (Test Management) , when customer uses jira's clone functionality, our data (steps) are not copied on newly created jira issue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Resurrecting an old post, but you could look at the issue links and check the outward description. Here's some sample code. I haven't tested it so it may not compile.
Issue issue = event.getIssue(); IssueLinkManager issueLinkManager = ComponentAccessor.getIssueLinkManager(); IssueLinkTypeManager issueLinkTypeManager = ComponentAccessor.getComponent(IssueLinkTypeManager.class);
// Alternatively you could put the "Cloners" issue link type id in a constant rather than try // to find it by name and assuming the first list result is the one you want. List<IssueLinkType> clonersIssueLinkTypes = issueLinkTypeManager.getIssueLinkTypesByName("Cloners"); Long cloneIssueLinkTypeId = null; if (clonersIssueLinkTypes) { cloneIssueLinkTypeId = clonersIssueLinkTypes.listIterator().next().getId(); } else { LOG.warn("Unable to find the 'cloners' issue link type, cannot continue..."); return; }
List<IssueLink> outwardLinks = issueLinkManager.getOutwardLinks(issue.getId()); if (outwardLinks) { for (IssueLink issueLink : outwardLinks) { if (issueLink.getIssueLinkTypeId() == cloneIssueLinkTypeId ) { // This is a cloned issue, do things and stuff. } } }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
We actually solved it this way
http://wiki.idalko.com/display/TGPD/Behind+the+scenes+of+gd.initFromClone
Still I think this should be part of the core product.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That's a good way to handle it. I ended up doing pretty much the exact same thing. On issue created, if "OriginID" is null, this is a brand new issue so set OriginID to the issue key of the newly created issue. If not null, then this is a clone of an existing issue, do whatever needs to be done and update OriginID.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.