Hi,
You can use ScriptRunner Listener to delete link if linked issue is not from current project.
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.link.IssueLink
import com.atlassian.jira.event.issue.IssueEvent
import com.atlassian.jira.event.issue.link.IssueLinkCreatedEvent
def issueLinkManager = ComponentAccessor.getIssueLinkManager()
Issue currentIssue = event.getIssueLink().getSourceObject()
def currentProject = currentIssue.projectObject.name
def linkedIssue
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
issueLinkManager.getOutwardLinks(currentIssue.id).each { issueLink ->
linkedIssue = issueLink.destinationObject
if( linkedIssue.projectObject.name != currentProject )
{
issueLinkManager.removeIssueLink(issueLink, user)
}
}
thanks,i want to write this code in listener and i have this error
unable to resole class "import com.atlassian.jira.event.issue.link.IssueLinkCreatedEvent"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Did you used IssueLinkeCreatedEvent? I have to some errors, but listener work good.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What version of Jira and Script Runner you have? Can you past here error?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Unfortunately Issue Linked Event was add in Jira 7.5.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
i resolved my problem with this code,thank you for your help
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.link.IssueLink
import com.atlassian.jira.event.issue.IssueEvent
import com.atlassian.jira.project.Project;
import com.atlassian.jira.project.ProjectManager
import com.atlassian.jira.event.issue.EventUtils
Issue issuesou=event.issue;
def issueLinkManager = ComponentAccessor.getIssueLinkManager()
Issue currentIssue = issuesou
def currentIssueId = issuesou.getId()
def currentProject = currentIssue.projectObject.name
def linkedIssue = issuesou
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
issueLinkManager.getOutwardLinks(currentIssueId).each { issueLink ->
linkedIssue = issueLink.getDestinationObject()
if(linkedIssue.projectObject.name != currentProject )
{
issueLinkManager.removeIssueLink(issueLink, user)
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
i resolved my problem with this code,thank you for your help
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.link.IssueLink
import com.atlassian.jira.event.issue.IssueEvent
import com.atlassian.jira.project.Project;
import com.atlassian.jira.project.ProjectManager
import com.atlassian.jira.event.issue.EventUtils
Issue issuesou=event.issue;
def issueLinkManager = ComponentAccessor.getIssueLinkManager()
Issue currentIssue = issuesou
def currentIssueId = issuesou.getId()
def currentProject = currentIssue.projectObject.name
def linkedIssue = issuesou
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
issueLinkManager.getOutwardLinks(currentIssueId).each { issueLink ->
linkedIssue = issueLink.getDestinationObject()
if(linkedIssue.projectObject.name != currentProject )
{
issueLinkManager.removeIssueLink(issueLink, user)
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
It is not possible.
You could use this add-on for it:
https://marketplace.atlassian.com/apps/1216498/easy-links-for-jira?hosting=server&tab=overview
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @reza azad,
Welcome to the community.
You can do this by editing the permission scheme for your project (You must be an Administrator to do that). You should make sure, that the permission scheme is used only in your project, otherwise create a copy, edit that and assign it to your project.
There is a permission for linking issues. If you remove all associated roles, users and groups, nobody can create an issue link anymore.
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.