Hi,
Looking for a way to automatically link any issue that is mentioned in a comment, in any thread across all projects.
E.g. User 5 comments on a Jira Issue with a link to Jira Issue 101A
Issue 101A is then linked from the original Issue
Hello @Nick,
You can use script listener with MentionIssueCommentEvent. Let me know if you need more detail or help.
Regards,
Orkun Gedik
You are welcome @Nick.
You can use the following line to create link between issues.
ComponentAccessor.getIssueLinkManager().createIssueLink(Long sourceIssueId, Long destinationIssueId, Long issueLinkTypeId, Long sequence, ApplicationUser remoteUser)
Source issue and destination issue are depends on how you want to link issues.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you - what do you mean by "Source issue and destination issue are depends on how you want to link issues.
Simply want a "relates to" link between Issues
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What I meant is you can define your source issue and destination issue how link direction you want. Also what version of Jira you are using? If you are using version 6.X, you have to use "com.atlassian.crowd.embedded.api.User" instead of ApplicationUser. "user.getDirectoryUser()" returns the paramater you need.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It must be ApplicationUser. You can check it out here.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You need to import ApplicationUser. Add the following line in your script.
import com.atlassian.jira.user.ApplicationUser
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks so total script is
import com.atlassian.jira.user.ApplicationUser
ComponentAccessor.getIssueLinkManager().createIssueLink(Long sourceIssueId, Long destinationIssueId, Long issueLinkTypeId, Long sequence, ApplicationUser remoteUser)
I checked in ScriptRunner and it provides this error
The variable ComponentAccessor is undeclared
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Orkun Gedik @Tarun Sapra this is amazing functionality when it's working, any ideas why the above would fail?
Thanks so much.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Nick
You have to import the component accessor class as well
Add this in your code in starting of the class
import com.atlassian.jira.component.ComponentAccessor
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks, now it's
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.ApplicationUser
ComponentAccessor.getIssueLinkManager().createIssueLink(Long sourceIssueId, Long destinationIssueId, Long issueLinkTypeId, Long sequence, ApplicationUser remoteUser)
It shows a [Static type checking] Cannot find matching method
But I assume it will work anyway?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You may ignore that error, I assume it works. But the paramater that you are passing in createIssueLink() method is not initiliazed in your code (If you shared all script above).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Orkun Gedik @Tarun Sapra I wasn't able to get the able code working in its current form - as experienced Scriptrunner gurus would you happen to know what remains to be tweaked?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I wanted to mark this one as Done as I thought it would be really useful for others, the current script is failing when it runs based off the code above, what is missing?
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.
Hey @Tarun Sapra
Code is:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.ApplicationUser
ComponentAccessor.getIssueLinkManager().createIssueLink(Long sourceIssueId, Long destinationIssueId, Long issueLinkTypeId, Long sequence, ApplicationUser remoteUser)
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.
Hello @Nick
The approach suggested by @Orkun Gedik is useful for newly added issues in comments, but not if you want to link issues which are already added in the comments. Because the listener will be triggered based on the event MentionIssueCommentEvent only for new scenarios and not for existing tickets if you wish to link them.
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.