When we use Script runner "Clones an issue, and links" post function, the newly created tickets get all the links from source ticket. Is there a way to not to link this ?
Example:
I have created links "relates to ABC-001" and "Implements ABC-002" for ABC-123. From ABC-123, I am creating XYZ-456 using script runner "Clones an issue, and links" post function. The problem is, XYZ-456 also gets "relates to ABC-001" and "Implements ABC-002" . I don't want to see this.
I want only ABC-123 linked to XYZ-456
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
For your requirement, I suggest looking into ScriptRunner's HAPI unlink feature.
You can try something like the code below in the ScriptRunner Console:-
import com.adaptavist.hapi.jira.issues.Issues
def issue = Issues.getByKey('MOCK-1') // Change issue key
issue.outwardLinks.each {
issue.unlink('relates to', it.destinationObject) // change link type
}
Please note that the sample working code above is not 100% exact to your environment. Hence, you must make the required modifications.
Below is a screenshot of the configuration:-
If you observe the screenshot above, the code works and returns the expected output.
When doing this Clone Issue and Links Post-Function, you can use the Condition field and just add:-
issue.outwardLinks.each {
issue.unlink('relates to', it.destinationObject) // change link type
}
I hope this helps to solve your question. :-)
Thank you and Kind regards,
Ram
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.