Hi,
I want to distinguish Clone operation and clear certain field value through Script Runner custom post-function script.
How can I get the source issue object and confirm the issue is created by cloning (not created originally)?
I have tried using transientVars["sourceIssue"].key. But It returns null pointer.
Thanks
Hi @nnallusamy
If you are in the context of the cloned issue, you should be able to retrieve it by looking at outward linked issues that uses the 'Cloners' default issue linking. Something like:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.link.IssueLinkManager
def issueLinkManager = ComponentAccessor.issueLinkManager
def sourceIssues = issueLinkManager.getOutwardLinks(issue.id)
def sourceIssueObjects = []
// There could theoretically be more than one.
sourceIssues.each() { issueLink ->
if (issueLink.issueLinkType.name.equals("Cloners")) {
sourceIssueObjects.add(issueManager.getIssueObject(issueLink.destinationId))
}
}
return sourceIssueObjects
This is just from the top of my head. I haven't tried to run it in a post-function, but I hope it helps :)
Hi @Mathis Hellensberg , Thanks for the response.
def sourceIssues = issueLinkManager.getOutwardLinks(issue.id)
sourceIssues returns EMPTY [] always since I am adding this script in Create transition which is 1st step the workflow.
I am also adding this at the end in the post-function list (even after re-indexing step). Still, It returns EMPTY / null always.
Don't know what else to do.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
def sourceIssues = issueLinkManager.getOutwardLinks(issue.id)
sourceIssues always return EMPTY list since I am adding it on Create transition which is the 1st step in the workflow.
Also, I have added the post-function script at the end (even after re-indexing step)
It still returns EMPTY always.
Don't know what else to do.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hmm after I checked, it seems I'm having the same problem.
I tried using a doAfterCreate callback, which doesn't seem to work either.
I hope someone else can figure it out.
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.